Just when they needed it most, Scotland found a pocket of excellence that saw them home, a rare moment of clear thinking and ruthless execution that gave them the cushion that they would not relinquish.
Six minutes left on the clock in this nerve-shredding epic and the Scots' lead was slender indeed as they chased a Rugby World Cup quarter-final berth.
Three points separated them from Samoa. Vern Cotter's side had been blasted to kingdom come in the early exchanges, dynamited by their own shortcomings and by a relentless Samoan side that shamed the imposters who went down so meekly against Japan a week earlier.
Scotland had constructed an error mountain in a wretched first half, but had fought their way back. They had become dominant in possession and territory. Not impressive, but better than before.
Still that gap on the scoreboard was painfully narrow. All over St James' Park, Scots bit their fingernails and watched between the cracks in their fingers.
Best call of career
They had penalty after penalty and moment after moment inside Samoa's 22, but they couldn't finish.
Six minutes. They rumbled their way to the Samoa posts and yet again referee Jaco Peyper shot his arm up in the air to signal a penalty. It was the 12th the Pacific Islanders had given away in the half and their 19th of the match. No yellow card - incredibly - but a chance for Scotland to widen the gap.
It was a decision for Greig Laidlaw. Take the easy three points and make it a six-point game, or go for the scrum and the chance of a try and a 10-point lead. Laidlaw consulted and made the best call of his career. Scrum, snipe, try for the scrum-half.
In that moment, a small group of Scotland fans whipped out their bagpipes high up in the main stand and got blowing. The strains of Flower of Scotland were heard. Some of their fellow supporters took pictures of these defiant boys who somehow managed to smuggle banned instruments into the stadium.
As this merry scene unfolded, Samoa attacked and scored. Almost as soon as pipes began, they fell silent again.
Lord how Scotland needed that converted try. Three points wouldn't have been enough, not when Motu Matu'u went over for a try in the dying minutes, not when Patrick Fa'apale added the extras. Had Laidlaw settled for three, Scotland could have been heading out of this World Cup, in shock and despair.
Instead they're moving south, bruised but believing that as underdogs in their quarter-final at Twickenham next Sunday they still have plenty of bite.
Bizarrely, Scotland have won two of their last three Tests against the Wallabies. In 2009, Scotland won at Murrayfield thanks, in part, to Matt Giteau, still on the scene now, goal-kicking with all the accuracy of Mr Magoo.
The second was won in an Australian monsoon in the summer of 2012. Credible, but not all that relevant. Those Wallabies were not as good as this current lot and those games were peace-time matches, little more than friendlies.
Scotland will be huge underdogs and that's a mindset that will suit them. They have nothing to lose. The pressure next Sunday will be completely different to the must-win stress of Saturday in Newcastle that almost choked them.
Relief was the dominant emotion. Waves and waves of relief. Scotland had been brought to the wire by Samoa and the dizzying brush with death had begun almost from the get-go.
After 11 minutes, Samoa scored their first try, running through gaps and beating away tackles and squeezing over in the corner. Scotland responded through Tommy Seymour and from that moment it was madcap stuff.
Samoa carried hard and often. They launched their big runners and Scotland couldn't cope. Maurie Fa'asavalu, Jack Lam and Alafoti Fa'osiliva, their fiendish back-row, blasted Scottish tacklers out of their way.
When they weren't going direct, they were going wide and exploiting Scotland's ragged defences. Cotter's team had little ball and little composure. Every time the game re-started, they added to their blunder count and invited Samoa on to them.
It was a frenzy. Thrilling and, for Scotland, terrifying. Samoa scored, then Scotland scored, then Samoa, then Scotland. In the midst of all this, Ryan Wilson got a yellow card for a stamp - it could have been red - and then Samoa came again.
At the break, Samoa had three tries and a three-point lead; 26-23. Scotland's first-half sickness had struck again despite their talk all week of putting the fixes in place. Four poor starts and four recoveries.
Whatever has ailed this team in the beginning of these World Cup games you can't fault their character in overcoming the problems they've created for themselves.
It was a long road back, though. Oh so long. When they started to apply the pressure, Samoa's only way of hanging on was to break every rule in the book. They conceded five penalties in the first 10 minutes of the second half, six in the first 13 minutes, nine in the first 22 minutes.
Scotland had one attacking line-out after another deep in the Samoa 22 and yet they couldn't put them away. They made do with two Laidlaw penalties that gave them that three-point advantage. Three points and tens of thousands of squeaky bums.
In trying to ease away on the scoreboard, Laidlaw missed a penalty, then he missed another.
We have seen how captains can get it wrong at this World Cup - England's Chris Robshaw will never live it down after his choice against Wales - but in that critical time six minutes from the end, Laidlaw, and his team, got it exactly right. That scrum and that try gave them a buffer - and they needed it.
It was a big call. The biggest call. A call that helped them into the quarter-final after missing out four years ago. They'll reset their ambitions now. They'll believe they can be a whole lot better against Australia than they were against Samoa. They'll have to be.
The bottom line is that they're through. They've regained their place at the top table of eight nations and, with it, their relevance on the world stage.