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 Wales 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.
Scotland coach Gregor Townsend will be concerned by his side’s capitulation having been so dominant in the first half, while Wales counterpart Warren Gatland will rue six lost lineouts on their own throw, several in attacking situations.
“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 [in the second half]. We 100% believed we could come back and win.”
Scotland’s win was their first in Cardiff since a 27-22 success in 2002, a game in which coach Gregor Townsend played and Wales captain Dafydd Jenkins was not yet born. Scotland did win 14-10 in Llanelli in front of empty stands in 2020.
Wales’ inexperience was illustrated by debutant fullback Cameron Winnett, 21, who was playing just his 16th game of professional rugby, but the way they rallied in the final 30 minutes will give them great heart.
Scotland captain Finn Russell landed an early penalty as they camped in the Wales half and were rewarded with the game’s first try.
Schoeman burrowed over under the posts as Wales were overrun in defence, unable to hold out as the visitors pummelled their line with bruising ball carriers.
Scotland’s second score 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 for an easy run-in.
It was a first try for Van der Merwe against Wales and completed his set of scoring against every Six Nations opponent.
Scotland’s 20-0 lead at the break was their biggest halftime advantage over Wales since 1924 and that was extended when Van der Merwe crossed for his second, with Russell again the creator.
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.