Winger Duhan van der Merwe scored two tries as Scotland claimed a dramatic first win in Cardiff for 22 years after withstanding a remarkable fightback from Wales to seal a 27-26 victory.
Prop Pierre Schoeman also crossed for a try for the visitors who led 27-0 early in the second half and looked like racking up a record score against the Welsh before yellow cards for hooker George Turner and centre Sione Tuipulotu killed their momentum and the hosts scored 26 unanswered points.
Wales, who picked up two bonus points, burst into life to use their numerical advantage to great effect, scoring four tries through flankers James Botham and Alex Mann, winger Rio Dyer and number eight Aaron Wainwright.
"We are a little bit disappointed, the win is good but that second half is nowhere near where we need to be," Scotland captain Finn Russell said. "In the second half our discipline was poor, the two yellow cards let them back into the game.
"When Wales scored that try early in the second half we got a little complacent, we thought the game was done. There are a lot of positives, but we need to be a lot better. If we get messages from the coaches we need to listen to them."
Scotland's victory was their first in Cardiff since a 27-22 success in 2002, a game in which current coach Gregor Townsend played and Wales captain Dafydd Jenkins was not yet born.
The Scots did win 14-10 in Llanelli in front of empty stands during the COVID-19 pandemic in 2020.
DISAPPOINTING RESULT
"It is an extremely disappointing result, but I am proud of the boys' performance in the second half. We could easily have given up, but we stuck in the fight," said Jenkins, Wales' second youngest ever captain.
"We sped up the ball a bit in the second half and that allowed us to play a bit more. We are a young team, there is no fear and we will be looking to build on this."
Wales' inexperience was illustrated by debutant fullback Cameron Winnett, 21, who was playing his 16th game of professional rugby.
Schoeman burrowed over for Scotland's first try and their second came from excellent play by Russell, who orchestrated his side's attacking tempo with a series of clever passes and kicks, ghosting into a gap before releasing Van der Merwe.
The visitors' 20-0 lead was their biggest halftime advantage over Wales since 1924 and that was extended when Van der Merwe crossed again.
It was there the game turned, however, as Wales piled on the pressure and forced Scotland to concede 14 penalties in a row.
They drove over from an attacking lineout for Botham's try and Turner was handed a yellow card for an illegal collapse of the maul.
Wales made their man advantage count when Dyer went over in the corner, before further scores by Wainwright and debutant Mann dragged them within a point with 12 minutes remaining.
"We probably wanted the game to go another five minutes. We left ourselves a bit too much to do, we were too inaccurate in the first half," Wainwright said.
"A lot of their ball in the first half came from our errors, we wanted to get our hands on the ball (second half). We 100% believed we could come back and win."
- Reuters