Scotland stumbled into the World Cup quarter-finals but only after a nerve-shredding 36-33 win over Samoa in Newcastle.
The Pacific islanders were playing only for pride but came close to killing off Scotland's participation in the tournament during an incredible clash at S t James' Park.
They scored three times through Tusi Pisi, Manu Leiataua and Rey Lee-Lo during a ridiculous first half which also saw Tommy Seymour and John Hardie cross over.
Scotland were much more solid after the interval and a touchdown from skipper Greig Laidlaw gave them breathing space before Motu Matu'u gave them one last scare at the death.
But they clung on to set up a last-eight clash with either Australia or Wales at Twickenham next Sunday.
Four years ago in New Zealand, Scotland suffered the shame of failing to reach the quarter-finals for the first time. Wins over Japan and the United States meant they needed just one more victory to avoid a devastating repeat.
But there was a feeling going into their decisive final clash that the only thing which could stop them from reaching the knock-out rounds was themselves.
Mental frailties were at the root of their football counterparts' failure to reach Euro 2016 this week and it quickly became apparent the rugby side suffered from the same condition as they opened up time and again during a crazy opening half.
Slow starts have become a theme of Scotland's World Cup but this was shambolic as Samoa were allowed to crash through the gain-line 28 times in the first 40 minutes alone.
Pisi and Laidlaw exchanged penalties before things took a turn towards the absurd.
First Mark Bennett failed to deal with Pisi's kick-off and with Samoa surging forward, the fly-half was able to finish off in the corner as he squeezed the ball down before converting his own score.
Seymour responded instantly for Scotland as he beat Paul Perez to a loose ball, tipping the ball over the wing before dotting down.
Laidlaw converted but once again they allowed Samoa to steal back possession from the restart. With their defence at sixes and sevens, there was no one free to stop hooker Leiataua bundling over for his side's second. Pisi at least missed the conversion.
Scotland pulled some points back with another Laidlaw kick but their appalling lack of concentration was exposed again from another kick-off. With cover in the wide channels almost non-existent, Lee-Lo only had to slam past the exposed Stuart Hogg on the line to add try number three.
Again Pisi failed to add the extras and Laidlaw was able to limit the damage with a penalty.
The last thing they needed though was for flanker Ryan Wilson to get himself sin-binned for stamping on the arm of Maurie Fa'asavalu right in front of his own posts. Pisi rubbed salt into Scottish wounds with another penalty.
With 32 minutes played though, it looked as though Scotland had at least sorted their issues. Finn Russell kicked to the corner and from a determined line-out drive Hardie got the ball down for his second World Cup try, setting up Laidlaw to level the scores.
But the drama was not done there. Prop Sakaria Taulafo thought he had scored again for Samoa, only for referee Jaco Peyper to rule it out after the television match official spotted Pisi's off-the-ball tug on Laidlaw in the build-up. Pisi's penalty put his side back in front.
Sanity looked to have returned to the Scottish ranks after the break as they finally managed to hold on to some meaningful possession before Laidlaw put his side in front for the first time with two quick-fire penalties.
The gaps that opened up all too easily in the first half had closed up but two missed kicks from the skipper kept the tension high.
It was harem-scarem stuff as both side battled back and forth. The introduction of Sean Lamont for his 100th cap brought a standing ovation from the large Scottish support but they were quickly perched back down on the edge of their seats.
The Scots wanted a score to make certain of the win. WP Nel thought he had it after crashing over the line but there was frustration as the ball was held up by Kahn Fotuali'i.
Those groans were soon replaced by cheers when Scottish pressure eventually told, allowing Laidlaw to skip off the back of a ruck and dive over.
His conversion gave his side a 10-point advantage but Samoa were not finished yet and set up a grand-stand finish with Matu'u's score from close range, converted by Patrick Fa'apale.
But Scotland saw out the final 60 seconds without further scare to finally clinch their place in the last eight.
Do YOU want to write for GiveMeSport? Get started today by signing-up and submitting an article HERE: https://www.givemesport.com/writeforgms