Australia were bowled out for 47 - their fourth lowest Test total and their lowest for 109 years - by South Africa as 23 wickets fell in one day.
The Aussies had started the second day on 214-8 in their first innings and were bowled out for 284, before skittling the Proteas for 96.
Having narrowly avoided the follow-on, the home side's pace bowlers then tore into a shell-shocked Australia.
But with the Proteas chasing 236 to win, Australia are still in the game.
After they had slumped from 21-6 to 21-9, only a dogged last-wicket stand by tail-enders Peter Siddle and Nathan Lyon pushed the tourists ahead of the all-time lowest Test score - New Zealand's 26 against England in 1955.
The day began with Aussie skipper Michael Clarke unbeaten on 107, and he shepherded the tail well before he was last out for 151, equalling his third highest Test score.
Openers Jacques Rudolph (18) and Graeme Smith (37) started well as South Africa reached 49-1 at lunch, but all-rounder Shane Watson produced a devastating spell after the interval, taking 5-17 in five overs including three lbws.
Ryan Harris (4-33) helped wrap up the tail as last pair Morne Morkel and Imran Tahir ensured the Proteas avoided the follow-on.
In all, 12 wickets fell in the afternoon session as Australia were 13-3 by tea - and as the evening began, it was Test debutant Vernon Philander's turn to shine as he recorded figures of 5-15 from seven overs.
The pace bowler, recalled more than three years after the last of his handful of limited-overs international appearances, had Australia on the rack before Siddle (12 not out) and Lyon (14), with a combination of edges and bold attacking strokes, ensured the tourists avoided total humiliation.
South Africa lost Rudolph before the close as they finished the day on 81-1, chasing 236 to win an incredible game. (BBC SPORTS)