After morning rain on Thursday, Travis Head's century and Scott Boland's defence initially repelled the Proteas.
But both Head and Steve Smith then fell in a brutal half-hour for Australia, leaving the Proteas in the box seat to level the series at 1-1 ahead of next week's third and final Test in Cape Town.
Australia must still contend with an allotted 44 overs in the final session on Thursday, although fading light could become an issue at St George's Park.
Head and Boland had initially looked in control through the first 80 minutes on Thursday, finding life much easier than in Australia's Wednesday horror show.
But when Head played onto his own stumps on 117 off Wiaan Mulder, the door was back open for South Africa.
Smith then inexplicably attempted to pull Kagiso Rabada (3-73) seven overs later against the new ball, skying him to Matthew Breetzke at mid-wicket.
Breetzke briefly juggled the catch, but in a long and storied career this was not one of Smith's finest moments given the match situation.
Boland, meanwhile, has batted with the patience Australia so dearly lacked when they were bowled out for 99 on day three, and were then asked to follow on.
The Victorian has got through 154 balls since being brought in as a nightwatchman on night three, in the longest innings of his Test career.
Head, meanwhile, brought up his century early on Thursday by clipping Marco Jansen to the legside boundary twice in the space of four balls.
The ton was just Head's second outside of Australia, and ended a disappointing run of cheap outs for the 32-year-old since the start of the Bangladesh Tests.
The opener celebrated like a man who knew there was a far bigger job to do, briefly raising his bat but going without the trademark helmet on the handle.
For 161 balls, he and Boland fought on, adding 59 runs for the fifth wicket.
But when Mulder angled a delivery in and it seamed sharply towards Head, the left-hander leapt up and jammed the ball down onto his own stumps.
Following Smith's exit, Alex Carey has reached tea unbeaten on 12.
One positive for Australia on Thursday was Cameron Green batting against bowlers in the nets again for the first time since straining his abdomen in the ODI series.
Australia's coach Andrew McDonald said on Wednesday that Green and Josh Inglis would be in the fight for selection for the third Test, with Inglis back from a fractured finger.
Cooper Connolly and Sam Harper are the other batters on tour, with Nic Maddinson, Beau Webster and Marnus Labuschagne all under immense pressure.