Winger Duhan van der Merwe has 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 on Saturday and looked like racking up a record score against the Welsh.
But yellow cards for hooker George Turner and Australian-born 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 No.8 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."
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.
"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 captain.
Wales' inexperience was illustrated by debutant fullback Cameron Winnett, 21, who was playing just 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.