Peter Nevill of Australia walks from the field after being dismissed. Photo / Getty
Australia narrowly avoided ending its first innings with a deficit after a stunning collapse at the WACA.
The fall of David Warner after a 158-run opening partnership sparked a capitulation of historic proportions as Steve Smith, Mitch Marsh, Mitchell Starc and Nathan Lyon fell for ducks.
Adam Voges fought hard to steady the Australian ship but fell just as he appeared ready to cut loose.
Australia's worst 7-wicket collapse (7-45) in Australia since 1936. #AusvRSA
The stodgy middle order batsman had moved patiently to 27 from 60 deliveries when he sent a leading edge back to Kagiso Rabada.
Starc, who was rated as a superior batsman to Mitchell Johnson by former Aussie skipper Michael Clarke before he came to the crease, followed soon after.
The left-hander attempted to hit spinner Keshav Maharaj over mid-on but didn't connect and sent a catch to Faf du Plessis to leave the score 7/203.
It was Australia's worst seven-wicket collapse since the time they lost 7/35, before being bowled out for 58, in the second innings of an Ashes Test at the Gabba in 1936.
Peter Nevill and Peter Siddle combined for a quickfire 29-run partnership off 5.5 overs for the eighth wicket before Nevill departed for 23.
The wicketkeeper became Maharaj's third victim when the ball ballooned off his pad to a diving Hashim Amla at first slip.
Replays indicated there was no inside edge. It made Shaun Marsh's earlier wasted review a costly one for Nevill - and the home side.
Josh Hazlewood made four runs before providing catching practice to the slips cordon, sending a gift to JP Duminy off the bowling of Vernon Philander to leave the home side 9/243.
Lyon also fell to a catch behind the wicket in the same over when he sent a nick to Dean Elgar at third slip. Philander finished with figures of 4/56 from 19.2 overs, leading the South Africa fightback after Dale Steyn left the ground with injury.