Saracens, the unbeaten English Premiership leader, capped a comeback from 18-6 down at halftime with a match-winning drop goal six minutes from the end by former Springboks flyhalf Derick Hougaard.
"We will remember this night for a long time to come," said Saracens director of rugby Brendan Venter, one of South Africa's 1995 World Cup winners.
"I know how courageous they had to be to fight back from 18-3 down. It was just a great performance from the team. It doesn't get much better for the club than this."
Having won the British and Irish Lions series and the Tri-Nations this year, South Africa has now lost to Leicester, France and Saracens in the past 10 days.
"We have brought a whole lot of youngsters over here on tour. Some have shown they are world class players, others have not," said Springboks assistant coach Dick Muir.
Up 6-3 on penalties, Boks center Juan de Jongh beat Saracens winger Noah Cato then stretched out in a tackle by opposite Kameli Ratuvou to dot down. Ruan Pienaar missed the conversion and a penalty but converted a second try by winger Jongi Nokwe, who collected a dropped up-and-under to score between the posts.
Hougaard's second penalty just before the break started a string of 15 consecutive points for Saracens, including a chargedown try for No. 8 Ernst Joubert which unnerved the Boks, and another try when Saracens streamrolled the Boks scrum and midfielder Bradley Britt busted through three defenders.
Hougaard converted for 18-18 but then squandered two dropped goal attempts and a penalty shot.
The Springboks struck back when fullback Earl Rose and winger Odwa Ndungane combined to set up Nokwe's second try.
But Hougaard's third penalty in the 69th minute cut the deficit to two, and his drop goal five minutes later secured the upset victory before more than 46 000 spectators.
"A lot of the stuff we did in the first half we didn't do in the second and a few decisions went against us," Muir said. "We put a lot of pressure on in the first half and did the opposite in the second."
South Africa finishes off its tour against Italy and Ireland.
Scorers were:
Saracens (6) 24: Tries by Ernst Joubert (45 min), Brad Barritt (53 min). Derick Hougaard kicked a conversion, three penalties and a dropped goal.
Springboks (18) 23: Tries by Juan de Jongh (28 min), Jongi Nokwe (37 min & 62 min). Ruan Pienaar kicked two penalties and a conversion.