Usman Khawaja fell in the penultimate over of the third day in Port Elizabeth to leave Australia in a precarious position in the second Test against South Africa.
Struggling for form, Khawaja made an excellent 75 that has at least given the tourists a chance of victory.
But his late dismissal saw Australia go to stumps at 5-180 in its second innings, holding a lead of just 41 runs.
South Africa took control of the match after AB de Villiers (126 not out) batted superbly with the tail to push the Proteas to a big first innings score of 382.
And lively bowling from Kagiso Rabada (3-38 off 16 overs) has South Africa in the box seat to level the four-Test series at 1-1.
Mitchell Marsh and Tim Paine are crucial to Australia’s hopes, unbeaten on 39 and 5 respectively.
De Villiers hailed the late wicket of Khawaja as key to the context of the match.
“It was vital for us to get a reward after toiling [in the last session] for that long,” he said.
Trailing by 139 after the first innings, Australia’s second dig started poorly as David Warner was bowled for 13 in the 10th over.
Rabada was responsible for the key wicket, bowling a brilliant delivery that nipped back just enough to hit Warner’s off stump, before he celebrated by screaming in the opener’s face.
And although Khawaja started brightly, hitting two of his first four balls for boundaries, he watched on as several partners departed.
Cameron Bancroft (24) once again did the hard work by seeing off the new ball before failing to capitalise, playing on off Lundi Ngigi (1-21 off 10 overs).
And the prized scalp of Steve Smith (11) soon followed as he fell to left-arm spinner Keshav Mahraj (1-70 off 20) for the third time this series.
Smith was caught behind and when Shaun Marsh (1) departed in similar fashion, the Aussies were at 4-86 and still well behind South Africa.
Khawaja and Mitch Marsh dug deep, though, producing a near chanceless stand of 87 runs as the former mixed his trademark elegance with resolute and compact defence.
But he did not see the day out, trapped lbw by a sharp Rabada delivery that swung the complexion of the Test.
And as Khawaja trudged off, it was hard to see a way out for Australia, with South Africa – greatly boosted by De Villiers’ first Test ton since January 2015 – well on top.
The tail wags
Earlier, the Proteas, who resumed at 7-263, frustrated Australia in a 119-run first session.
Vernon Philander (36) was the first to get going, hitting Josh Hazlewood (2-98) for two fours in the third over of the day.
De Villiers soon found the boundary, too, as the pair pushed South Africa past 300 and beyond.
Their 84-run partnership eventually ended when Philander, two balls after being dropped by Bancroft at short leg, was caught by the same fielder from a well-placed Pat Cummins (3-79) bouncer.
An action-packed over was then highlighted by de Villiers bringing up his 22nd Test century when he guided a short Cummins ball over the slip cordon.
“It means the world to me … I’ve worked very hard. I’m chuffed,” de Villiers said after play.
Maharaj replaced Philander at the crease and rode his luck at times to slog 30 from 24 deliveries as the South African tail continued to wag.
And although Hazlewood ended his entertaining stay, a 58-run partnership was crucial for the hosts, who enter day four as big favourites.
Rabada set to face the music
Rabada was to contest an ICC charge for making physical contact with Smith after dismissing him in Australia’s first innings.
Rabada has demerit points hanging over him and could miss the rest of the series if found guilty.
That would be a significant blow for South Africa, given the 22-year-old has already snared eight wickets in the Test.