Sri Lanka 304 for 5 (Dilshan 87, Perera 69*, Chandimal 59) beat South Africa 299 for 7 (de Villiers 96, Smith 68) by five wickets
Scorecard and ball-by-ball details
It took Sri Lanka three consecutive defeats to get their batsmen firing in unison. Tillakaratne Dilshan finally played with freedom to give the chase momentum, Dinesh Chandimal anchored it in the middle overs, and Thisara Perera stunned South Africa with sustained hitting to overhaul a stiff target in Kimberley. Perera had also struck crucial blows earlier with the ball, making South Africa lose their way in the final quarter of their innings, when 350 had looked achievable at one stage.
In the end, that late batting stumble on a flat pitch was where South Africa lost the game, after having been 171 for 1 in the 24th over and 242 for 3 in the 39th. They did have Sri Lanka requiring more than 100 at close to seven an over but the visitors always had wickets in hand, and Perera sealed the chase with a volley of sixes. He also pressurised South Africa's fielding, which unravelled in a series of dropped chances and missed run-outs.
Perera, playing his first game of the series, was promoted ahead of Angelo Mathews with Sri Lanka on 194 for 4 at the start of the batting Powerplay. When Perera was trapped lbw by Wayne Parnell off the sixth ball he faced, it looked like Sri Lanka had only heaped more pressure on Mathews. But Parnell was found to have overstepped by a big margin on referral, and it was to be Perera's night. He almost hit his next delivery straight back to Robin Peterson but recovered to slam the next two for a six and a four.
Perera swung the game in Sri Lanka's favour with consecutive blows over the midwicket boundary off Peterson in the 43rd over, the second bringing up his maiden ODI fifty off 30 deliveries. With 34 now needed off 42, Perera soon took Sri Lanka to the highest ODI total in Kimberley with a straight six off JP Duminy in the 49th over.
That Perera had a manageable asking-rate to contend with was down to Dilshan. With his captaincy on the line, and having made 0, 0 and an uncharacteristically subdued 33 in the first three ODIs, Dilshan's approach was anything but muted. His fluent 83-run partnership with Kumar Sangakkara set the tone for Sri Lanka's response.
South Africa tried to bounce Dilshan out but he pulled his second delivery for four, whipped his fourth over square leg for six and soon scooped Vernon Philander for six over fine leg. Despite Upul Tharanga falling early to Tsotsobe, Dilshan and Sangakkara never allowed the asking-rate to climb over six.
Sangakkara's first attempt to take on the left-arm spin of Peterson seemed to have paid off when he lofted the bowler cleanly towards the midwicket boundary. But Alviro Petersen pulled off an astounding leaping catch near the rope and Sangakkara could scarcely believe his misfortune.
Chandimal ensured Sri Lanka did not lose momentum. Two balls after Sangakkara fell, Chandimal stepped out to slam Peterson over the long-on boundary. Both Dilshan and Chandimal kept taking singles, and the stand was already worth 68 before Dilshan slapped Tsotsobe straight to short extra cover to depart for 87.
Lahiru Thirimanne followed soon but Perera arrived to take control of the innings, and despite Chandimal falling to Tsotsobe for 59, he ensured Sri Lanka had enough firepower to register their first win of the series.
It was Perera who brought Sri Lanka back after de Villiers had threatened to blow them away in a feast of exquisite boundary hitting. Perera removed Duminy and de Villiers in successive overs as South Africa stumbled from 242 for 3 to an ultimately underwhelming 299. Until de Villiers fell for 96 in the 41st over, South Africa had control over a listless Sri Lanka attack and were racing towards a total of about 350.
The under-pressure Graeme Smith made only his second half-century in 17 innings and his 84-run opening partnership with Alviro Petersen prepared a solid base for the middle order. de Villiers promoted himself to No. 3 and raced to 50 off 31 deliveries, peppering the extra-cover boundary with lofted shots.
Smith, who had been subdued throughout the series, was allowed to find much-needed form as Sri Lanka fed his strength by bowling on leg stump. From the moment he worked Lasith Malinga for consecutive boundaries, through fine leg and midwicket in the third over, Smith's struggle was over. In all, 57 of Smith's 68 runs came on the leg side.
While Smith had the poor lines to cash in on, de Villiers needed no help from the bowlers. He put on a display of effortless hitting, making room and carving the offspin of Sachithra Senanayake and Dilshan over extra cover. It made no difference where the spinners bowled - even deliveries fired in on leg stump met with the same fate as they disappeared over extra cover.
Kulasekara gave the visitors some respite when he trapped Colin Ingram leg-before. The scoring-rate, which was comfortably above seven, now started dipping. Duminy was unable to keep up the pace, and even de Villiers tapered off, making his final 46 runs off 45 deliveries.
After Perera's double-strike, Faf du Plessis came and went, but the lower order sensibly batted out the remaining overs to push South Africa to one short of 300. As it turned out, they hadn't budgeted for Perera's six-hitting prowess.
Abhishek Purohit is an editorial assistant at ESPNcricinfo