England were 83-5 – the sort of prickly predicament in which Bairstow often prospers for Yorkshire.
Ben Stokes had just got out to a grisly shot, spooning pace bowler Nuwan Pradeep to mid-on, and England had collapsed from 49-0.
But Bairstow totally transformed the mood, scoring an unbeaten 54 as he and Alex Hales (71) helped the hosts to 171-5 by the time rain washed out the last 37 overs.
It was as if the Yorkshire crowd, numbering 9,436 on a grey and gloomy day, were experiencing a case of deja vu.
RETRO SPOTLIGHT: 15 nostalgic Scarborough photos from the Scarborough News sports archives
Scarborough Athletic slip to 2-0 defeat at Brackley Town in National League North opener
Commonwealth Games 2022: Scarborough's Chris Turnbull and Team England win bowls mixed para pairs bronze medal
Ebberston battle back to sink hosts Filey in SBL Premier Division thriller
Tokyo Olympics 2020: Scarborough's Charlotte Fry and Team GB win team dressage bronze
For the number of times that Bairstow has salvaged Yorkshire from such dire straits – albeit from the No 5 position as opposed to No 7 – is incalculable; he is the cricketing equivalent of Red Adair.
He is also in the form of his life, having gone into the opening Test of the summer with 533 Championship runs to his credit at 88 after 1,108 last year at 92.
His second Test fifty at his home ground, where he scored 64 against New Zealand three years ago, was a typically momentum-changing effort, Bairstow dominating a stand of 88 with Hales in 21 overs.
Bairstow began in typically busy fashion, square-driving Pradeep through the offside and scampering a lung-bursting three.
Another three followed when he punched Pradeep off the back foot through the covers before his first unquestionably authoritative shot, a boundary off Dasun Shanaka that was not so much stroked through the covers as savaged.
Shanaka, the 24-year-old medium-pacer making his Test debut, had earlier vindicated Sri Lanka’s decision to field with three wickets in eight balls just before lunch.
Bowling from the Kirkstall Lane end, he tilted the session in favour of the visitors after they had started the match in mediocre manner.
First, Shanaka drew Alastair Cook into a most un-Cook-like drive outside off stump that had the captain caught behind for 16.
Cook had gone into the game needing 36 to become the 12th man – and the first Englishman – to reach 10,000 Test runs, a milestone that must wait for another day.
Instead, it was Cook’s opening partner, Hales, who displayed the necessary approach and application, reining in his natural attacking instincts in an impressive response to his critics.
But Nick Compton, whose critics are no less widespread, fell three balls after Cook when he edged to first slip, Shanaka following up with the key wicket of Joe Root when the Yorkshireman got a thick edge to gully.
Root’s last three Test innings at Headingley are 1, 0, 0, a strangely incongruous sequence of failure.
James Vince – handed his Test debut on the back of a hundred at Headingley for Hampshire last month – took 19 balls to get off the mark and then produced arguably the shot of the day, a gorgeous punch down the ground off Shaminda Eranga to the foot of the pavilion.
But Vince’s promising innings was ended when Eranga drew him into a loose drive taken at third slip, and after Stokes hit Eranga for three successive fours, an even more promising contribution met its disappointing end.
Enter Bairstow. To loud cheers from the home crowd, the Yorkshireman positively bounced to the crease, going through his customary warm-up routines.
Even the mere presence of Bairstow enlivens proceedings, which had been relatively sedate both before and after Shanaka’s intervention. When Bairstow strides out into such adverse positions for Yorkshire, he invariably endeavours to counter-attack.
He did so again, ticking along at around a run-a-ball without appearing to force the pace.
After Hales reached a 112-ball half-century with 10 fours, Bairstow grew increasingly confident. He contributed 34 to their 50 partnership, which arrived from just 75 balls as they put the pressure back on Sri Lanka.
When he had scored 40, Bairstow was given out lbw to Angelo Mathews, a decision he reviewed immediately.
Replays showed that the ball was drifting down leg-side, and Sri Lanka then wasted a review against Bairstow when he had 47 to his name, the on-field decision proving right as Rangan Herath’s lbw claim was also shown to be drifting down leg.
Bairstow reached his half-century from 59 balls with a steer to the third man boundary off Mathews.
He hit five other fours in a 67-ball innings, in addition to a seemingly effortless six over long-on off Herath towards the Trueman Enclosure.