David Warner's shoe came off then so did the wheels in Australia's innings as South Africa stayed alive in their one-day international series.
Australia was cruising at 157-2 in the 19th over in a chase of 339 until Warner lost his shoe and was run out. The visitors folded to be all out for 227 in the 35th over.
“Series is still alive, we've gone a notch up and want to keep raising the bar,” South Africa captain Temba Bavuma said.
South Africa won by 111 runs, finally defeating the Australians, who had won the first five tour matches, including sweeping all three Twenty20s. Australia has another chance to clinch the ODI series on Friday in the fourth match in Johannesburg.
Australia won the toss and gave an ODI debut to legspinner Tanveer Sangha, who made his T20 debut on this tour and took 4-31.
But Sangha wasn't introduced until Bavuma and Quinton de Kock laid another good platform.
The batters were 65 without loss after the powerplay and cracked on.
De Kock laid into Sean Abbott and Josh Hazlewood, and it took Travis Head to stop de Kock at 146-1 in the 23rd over. He sliced to backward point after 82 from 77 balls.
Bavuma hit straight to cover in the next over after 57 off 62, and Sangha had his maiden ODI wicket.
Aiden Markram wasn't fazed and pulled Sangha for a six. He maintained the momentum with Reeza Hendricks in a stand of 76 in 12 overs, and with Marco Jansen in a stand of 63 in five overs at the death.
Hazlewood was plundered for 23 runs in the 45th over, and Nathan Ellis went for 21 runs in the 47th.
Markram achieved his second ODI century off the last ball when he smashed Hazlewood back down the ground for his ninth boundary.
South Africa had 338-6 and Markram was 102 not out off 74 balls.
The South Africans were excited by the turn on offer after Australia part-timer Head collected 2-39 from 10 overs. South Africa picked two front-line spinners in left-armers Tabraiz Shamsi and Keshav Maharaj, and they took two wickets each.
But they had no impact at the start of the chase when Australia got off to another flyer.
Head pumped Jansen for three straight boundaries in the second over. Jansen went for 30 in his first three overs and was replaced by Sisanda Magala, who dismissed Head on 38.
Warner, dropped in the first over off Markram, reached a fifty off 27 balls by pulling Gerald Coetzee for a six over midwicket.
Australia was 104-1 after the powerplay. The momentum changed at 157-2 in the 19th over when Warner went for a single but slipped, lost his shoe, and still ran but dived too late — run out by a direct throw from Maharaj. Warner made 78 off 56 balls.
Marnus Labuschagne and Marcus Stoinis were stumped and Australia, at 178-5 in the 24th over, was in deep trouble.
The pressure was too much. Coetzee grabbed four of the last five wickets to have 4-50 but Shamsi and Maharaj were the architects of this win.