South Africa will start day four of the decisive third and final Test at Lord's just about on top, largely thanks to a stand of 81 for the third wicket between Jacques Kallis and Hashim Amla.
The pair survived a number of scares and looked set to bat into Sunday, before Steven Finn trapped Kallis lbw just before the close.
That will have given England renewed hope heading into day four of what is building to a fascinating climax to the series.
After being dismissed in their first innings for 315, England reduced South Africa to 50-2, a lead of just 44, and looked poised to grab the upper hand and set up a moderate target to level the series and retain their number one ranking.
But Amla and Kallis both responded to the pressure in perfect conditions and were seemingly in the process of batting England out of the game, before yet another twist 15 minutes before the close.
South Africa finished the day on 145-3, a lead of 139.
Earlier, England had recovered from Jonny Bairstow falling just five short of his maiden Test century to post a first-innings lead of six.
Bairstow went for 95 just before lunch but Graeme Swann still eked out vital runs with the tail - including 32 for the last wicket with Finn - as England were bowled out for 315 in early afternoon.
Bairstow, playing in this match only because England dropped Kevin Pietersen in controversial circumstances, got stuck in the 90s and was bowled playing across the line at Morne Morkel (4-80).
The 22-year-old had risen to the challenge of filling the biggest boots in the England dressing room, and dealt with considerable pressure too, after coming to the crease at 54-4 on Friday.
He made no mistake until, with three figures in sight, he fell in agonising circumstances.
Bairstow and sixth-wicket partner Matt Prior saw England through the first eight overs, to the second new ball - but no further.
Prior edged a drive to slip, to Vernon Philander's very first delivery after the new ball was taken.
Philander continued to find exaggerated swing against Stuart Broad, but both the new batsman and Bairstow found their scoring opportunities to take England ever closer to South Africa's total - until the left-hander fended a ball from Dale Steyn (4-94) straight to short-leg.
With Bairstow finally gone too, his 196-ball stay including 15 deliveries on 95, it seemed first-innings parity would be beyond England.
But Swann had other ideas, and received enough support from numbers 10 and 11 James Anderson and Finn to put the hosts in minor credit.
Graeme Smith and Alviro Peterson made a steady start to South Africa's second innings before Graeme Swann finally got the tourists' skipper lbw.
England's spinner had a review for an edge turned down but then moments later Smith attempted a sweep and was caught plum in front for 23 with the score on 46.
Hashim Amla was given a life by Matt Prior behind the stumps as a flick down the leg side off Broad went to ground, but two balls later England had their second wicket as Peterson played around a straight one from Broad.
Kallis and Amla survived a few scares as they carried the score to 131 before Finn got the brreakthrough.
Kallis was convinced he had hit the ball and reviewed the lbw decision, but hotspot showed he had in fact hit his pad twice. England's delight and relief suggested they feel that may be crucial heading into day four.