Fullback Damian Willemse kicked a pressure penalty after the hooter to secure South Africa a 32-29 victory over ill-disciplined Wales in a see-saw test at a raucous Loftus Versfeld on Saturday.
Wing Louis Reece-Zammit crossed for two tries and Dewi Lakea got a third for the visitors, who took the world champions close but paid the price for their cynical play in their own 22 as they lost four players to yellow cards and conceded a penalty-try.
Hookers Bongi Mbonambi and Malcolm Marx, and wing Cheslin Kolbe, crossed for tries for the home side, who were playing their first test in eight months.
The second of three tests in the series will be played in Bloemfontein next Saturday with Wales still in search of a first win in South Africa after 11 attempts.
"I'm gutted, there was a lot of momentum shifts in that game and we thought we nicked it but it wasn't to be," Wales flank Dan Lydiate told Sky Sports.
"We were disappointed after the Six Nations and we wanted to put in a good performance today to restore pride in the jersey, but we came here to win and we're gutted with the result.
"Discipline, we talked about it going into the camp, and we have to look at ourselves and rectify it for next week."
Wales had threatened to spoil the party as a sell-out crowd of 51,762 roared on the Boks, the first time in 1,051 days the home side had played in front of their own fans.
They will have felt let down with the opening 60 minutes of the game as Wales led 18-3 at halftime and were good value for that advantage against a sloppy home side.
But once the altitude began to play its part, South Africa forced the visitors into cynical penalties in their own 22 through sheer pressure and power on the ball.
The game swung in their favour as Wales at one stage had only 12 players on the pitch after yellow cards in the game for skipper Dan Biggar, Alun Wyn Jones, Reece-Zammit and Rhys Carre.
Biggar had the chance to put Wales in front with two minutes on the clock but missed the conversion of Lake's try, which allowed the Boks to go up the other end of the pitch and steal the victory.
"They stopped our mauls and we couldn't get going, but the way we came back, that's what we take pride in," Bok captain Siya Kolisi said.
"Wales knew what we wanted to do and they stopped that to start, we weren't kicking on our terms.
"So we had to find energy, the guys off the bench did that; we have so much respect for them and it is always difficult to play them."