In an extraordinary match, the Scots led 17-3 deep in the first half but were reduced to 14 men in the second period when Zander Fagerson saw red.
Wales deserve great credit for the way they fought back, with the impressive Louis Rees-Zammit scoring two tries, but this was a missed opportunity for Gregor Townsend’s team.
The home side were looking to win their opening two games in the Championship for the first time in 25 years but, seven days after the historic triumph at Twickenham, it was Wales who made it two from two.
They outscored the Scots by four tries to three, with Liam Williams and Wyn Jones adding to Rees-Zammit’s brace.
Scotland responded with some fine scores of their own, all of them made in Hawick. Darcy Graham got the first and captain Stuart Hogg the other two in a topsy-turvy encounter.
Hogg had a last-gasp chance to snatch victory for Scotland but couldn’t hold on to Duhan van der Merwe’s pass with the clock showing 80 minutes.
The pre-match preliminaries were observed in a more co-ordinated fashion this week, with all players remaining standing for a “moment of reflection” on the fight against racism and discrimination.
There had been a few flurries of snow during the warm-up but they had eased off by the time of kick-off and although it was bitterly cold there was mercifully little wind inside the empty bowl.
Wales won an early penalty, with Matt Fagerson the culprit at the maul, and they opted to kick to the corner. From the lineout, the visitors build the phases and the pressure eventually yielded a kickable penalty after Chris Harris was judged offside. Leigh Halfpenny stepped up to boot Wales into a 3-0 lead from just inside the 22.
It was the wake-up call Scotland needed and they went to the corner themselves just moments later. Alun Wyn Jones was penalised for not rolling away and Finn Russell kicked the penalty to level things.
The Scots were forced into an early reshuffle when a grounded Blade Thomson felt the full force of team-mate George Turner’s knee. He went off for a head injury assessment and never returned, with Gary Graham replacing him for his fourth cap.
Scotland then took a grip on proceedings with two tries in six minutes.
The first, from Darcy Graham, came from a delightful piece of ingenuity. Russell had found a gap in the Welsh midfield and offloaded to Jonny Gray. from the resulting ruck, scrum-half Ali Price delivered a delicate right-footed chip over Welsh heads. It was read superbly by Graham who gathered smartly and ran in for a superb score under the posts, which Russell converted.
Scotland had their tails up and quickly increased their lead. The ball was put though the hands of the backs in a move that stretched across the width of the pitch. When the ball reached Hogg on the right wing, the Scotland captain kicked through.
It should have been a simple mop-up job for Halfpenny but as he slid in to gather the ball it squirmed from his grasp and Hogg was able to follow up and force his way over the try.
Russell’s conversion from wide on the right was good and Scotland were now 17-3 ahead.
Hogg, last week’s man of the match, looked in the mood and went on a mazy run which would have had the crowd on their feet had they been here.
Another promising Scotland move was ended by Halfpenny’s uncompromising tackle on Darcy Graham. The winger had been taken out in the air. Halfpenny escaped the yellow card but was injured in the incident and had to go off.
With time running out in the first half Wales were starting to feel their way back into the match. The visitors were camped in the home 22 and when Scotland got their maul defence wrong, they pounced, moving the ball wide thought the hands of Dan Biggar and Nick Tompkins before Rees-Zammit scored in the corner.
Scotland thought they had scored again early in the second half but the try was ruled out for blocking and two minutes later Wales made them pay.
Once again, they used the maul to good effect and created a numerical advantage on the left, allowing Williams to run in for the try which Callum Sheedy converted to reduce Scotland’s lead to 17-15.
The home side had lost the momentum and things unravelled further with Zander Fagerson’s red card in the 53rd minute. The big prop was guilty of coming in from distance and hitting his shoulder into the head of Wyn Jones. Referee Carley had a look at it on the big screen before making his decision.
Wales punished Scotland further with a pushover try two minutes later, with Wyn Jones barging over from close range. Sheedy missed the kick but Wales were now 20-17 ahead.
The Scots were a man down but they continued to show attacking ambition. Russell tried to play in van der Merwe but his cross-field kick was just too strong. But Scotland continued to press and got their rewards.
From a scrum in front of the posts, Russell played in Hogg who found the gap and managed to ground the ball despite the efforts of Tompkins to hold him up.
Russell’s conversion from the corner was spot on to move Scotland 24-20 ahead.
The lead didn’t last long. Wales countered with a marvellous try from Rees-Zammit who kicked ahead, then outpaced Hogg and van der Merwe before dotting down in the corner.
The conversion was missed but Wales now held a one-point advantage which they would cling on to.