Epic Wales comeback falls agonisingly short as Scotland cling on for Six Nations win
Scotland ended 22 years of hurt in Cardiff after they thwarted a spectacular Wales fightback to win an extraordinary Six Nations clash 27-26.
It was Scotland's first win in the Welsh capital since 2002 - ending a run of 11 successive defeats - to set up a mouth-watering Murrayfield encounter against France next Saturday.
But Wales made them fight every inch of the way after the Scots had breezed into a 27-point lead after 42 minutes, with wing Duhan van der Merwe scoring two tries including a virtuoso long-range effort while prop Pierre Schoeman also touched down.
Captain Finn Russell kicked three conversions and two penalties, but it only told half the story.
Flanker James Botham's try sparked the Welsh recovery then he was followed over the line by Rio Dyer, Aaron Wainwright and debutant Alex Mann, with Ioan Lloyd kicking three conversions.
Scotland found themselves on the rack after hooker George Turner and centre Sione Tuipulotu were sin-binned during the second period, yet they successfully closed the game out and left Wales wondering what might have been.
Both teams started brightly under the stadium's closed roof and Scotland struck first when Russell kicked an angled 20-metre penalty, before quick lineout ball gave Tuipulotu a chance that Wales managed to defend.
Wales, though, could not stop wave after wave of attacks that led to the game's opening try after 11 minutes.
Russell created initial space and after a strong run by wing Kyle Steyn, Scotland's forwards took over and Schoeman crossed from close range. Russell's conversion made it 10-0.
Scotland enjoyed scrum and lineout dominance and they controlled the opening quarter, even if Wales established promising attacking positions at times.
Russell extended Scotland's lead with a second penalty - Wales wing Josh Adams was punished for throwing the ball away and denying Scotland a quick lineout throw - and alarm bells were beginning to ring for Gatland's team.
Inevitably, Russell was at the heart of everything good about Scotland's magic and he weaved his magic to devastating effect 10 minutes before half-time.
Scotland set up a strong position inside Wales' 22 and the rest was all about Russell, who ghosted into space, threw a half-dummy pass, then delivered a try on a plate for Van der Merwe.
There appeared no way back for Wales, with their problems showing no sign of abating as fly-half Sam Costelow went off for a head injury assessment as Scotland led 20-0 at the interval.
It got even worse for Wales just two minutes into the second period when Van der Merwe carved them open from deep to claim a blistering solo touchdown, and Russell's conversion put further daylight between the teams.
Costelow failed his HIA and Gatland made three half-time changes, sending on scrum-half Tomos Williams, hooker Elliot Dee and prop Keiron Assiratti, and Wales opened their account when Botham crashed over.
Turner was sin-binned for an offence in the build-up to Botham's try and Wales struck again, this time through Dyer, with Lloyd's conversion cutting the gap suddenly and unexpectedly to 15 points.
It was panic stations for Scotland when Tuipulotu went into the sin bin and Wales punished them immediately as Wainwright touched down for a third try in 13 minutes, with Lloyd converting.
The capacity crowd could scarcely believe what they were witnessing, but it was Williams's influence off the bench that proved key as he injected pace and purpose into Wales' game.
And when Mann claimed a 68th-minute try, again converted by Lloyd, the improbable dream edged closer, with Scotland looking bewildered and devoid of answers.