Dan Biggar struck a drop-goal in first-half stoppage time to give his side a 13-12 lead at the halfway stage of a breathless Rugby World Cup quarter-final with South Africa at Twickenham this afternoon.
Wales made a storming start to the match and almost went over for a try within the opening three minutes, but George North's powerful run was finally stopped just short of the line.
Warren Gatland's side, looking for just their third win in 31 meetings with the Springboks, worked the ball over to the other wing, but the final pass was over the head of Tyler Morgan as the early chance went begging.
Indeed, it was South Africa who got the first points on the board when Handre Pollard knocked over a kick after North had been penalised for trying to steal the ball on the floor.
Discipline was a problem for the Welsh in their last match against Australia, and that looked like being the case again when Alun Wyn Jones, on his 100th international appearance, was pulled up and Pollard doubled his side's lead with the resulting penalty.
In response, Wales stole the ball quickly after kickoff and, although Luke Charteris gifted it straight back to South Africa with an attempted offload, Tendai Mtawarira held on to give Biggar the simplest of kicks right in front of the post.
Those three points were soon cancelled out by another Pollard penalty, but Wales hit straight back with the only try of a frenetic opening period as Biggar collected his own kick before finding Gareth Davies to go over.
Gatland's side continued to be the architects of their own downfall, though, and despite looking the more dangerous of the two sides in possession they found themselves behind once again when Pollard knocked over his fourth penalty of the opening 21 minutes.
Turnovers, penalties and a kicking battle became the story of the rest of the half, although scoring chances were kept to a minimum until the closing stages.
Wales missed a late chance to take a one-point lead into the interval when Biggar's long penalty struck the post, but he made up for that in stoppage time when he put a drop-goal over to edge his side in front.