Sri Lanka 154 (Dickwella 42, Rabada 4-38, Olivier 3-61) and 60 for 2 (Oshada 17*, Olivier 1-10) need a further 137 runs to beat South Africa 222 and 128 (du Plessis 50*, Lakmal 4-39, de Silva 3-36)
As many as 18 wickets tumbled on day two at St George's Park, leaving the second Test dangling on a razor's edge. After three innings unfolded on a manic day, Sri Lanka were 137 runs away from becoming only the third side - after England and Australia - to secure a Test series win in South Africa.
How did it come down to this after Sri Lanka were dismissed for 154 in their first innings, conceding a 58-run first-innings lead? South Africa suffered a more dramatic collapse, losing 7 for 38 despite a defiant, unbeaten half-century from their captain Faf du Plessis.
No Lasith Embuldeniya? No problem for Sri Lanka. Part-time offspinner Dhananjaya de Silva scripted South Africa's downfall with his turn - or the lack of it. Moments before tea, he drifted a full ball away from Hashim Amla to have him nicking off for 32. Aiden Markram and du Plessis aside, Amla was the only South Africa batsman to reach double figures. All told, South Africa registered 15 single-digit scores in the match.
De Silva could have also dismissed du Plessis on 45 when he had him stumped off a ball that shot through low, but replays revealed that he had overstepped. He wore a wry smile, coach Chandika Hasthurusingha had his face in his hands, and Embuldeniya scratched his head in frustration. All of that turned into joy after de Silva and Suranga Lakmal worked their way around du Plessis to bundle South Africa out for 128 in 44.3 overs.
Lakmal was particularly lethal with his inswingers against the lower order, claiming 4 for 39. Vishwa Fernando and Kasun Rajitha played their part as well, having carved up South Africa's top order once again.
Sri Lanka's top order did not fare any better either in their chase of 197. Lahiru Thirimanne hung his bat out outside off - possibly wider than a set of stumps outside off - to edge Kagiso Rabada to Quinton de Kock for 10. In the next over, Duanne Olivier's first in the fourth innings, Dimuth Karunaratne feathered one behind as the Port Elizabeth Test continued to swing wildly.
The new ball did not swing as wildly, but there was enough movement to keep Kusal Mendis and Oshada Fernando on their toes. They safely negotiated the last 30 minutes or thereabouts to to keep Sri Lanka afloat.
That had not seemed likely when Sri Lanka had folded for 154 from an overnight 60 for 3 in their first innings, about half an hour before lunch. That they reached three figures was down to sparkling cameos from first-Test hero Kusal Perera (20 off 15) and Niroshan Dickwella (42 off 36).
Olivier had set the tone when he struck Thirimanne on his shoulder with the first ball of the day. In his next over, he found extra bounce from a length and had him scooping a return catch for 29.
The hit-the-deck bustle of Olivier and Rabada reduced the visitors to 66 for 5, but that did not stop them from throwing their bats at the ball. Kusal unleashed a devil-may-care slap over cover point off Olivier and proceeded to launch Rabada onto the roof over extra-cover. His innings, though, was cut short as Rabada tightened up to have him nicking off.
Dickwella then unfurled his trademark scoops and ramps, despite South Africa posting a fine third man, to haul his side past 150. He caught everybody's attention when he gave himself room and lifted an off-stump ball from Dale Steyn over slip for four. Having lived by the sword, Dickwella died by it, spooning a ramp to gully and giving Rabada his fourth wicket.
South Africa's batting line-up then disintegrated, leaving them hoping for more than an encore from Rabada on a deteriorating pitch. They will also be buoyed by the sharp turn and bounce that left-arm spinner Keshav Maharaj found in his first over - the last of the second day.