Sri Lanka levelled the one-day series against Pakistan with a thrilling two-wicket win in the second match in Dubai.
Angelo Mathews made 47 before it was left to Sachithra Senanayake to see Sri Lanka past Pakistan's 284-5 with two balls remaining, meaning Ahmed Shehzad ended up on the losing side despite a career-best 124.
Kumar Sangakkara top-scored for Sri Lanka with 58, Dinesh Chandimal hit 44 and Tillakaratne Dilshan 40 but they looked to be in trouble when they slipped from 159-2 to 173-5 during the batting powerplay.
Mathews and Nuwan Kulasekara (32) gave their side some hope again with a partnership worth 57 before an eighth-wicket alliance between the former and Dimuth Karunaratne (16 not out) moved them to the brink.
It seemed there could be a late twist when, needing just four off the final over, Mathews hammered a short ball from Shahid Afridi straight to Shehzad at mid-wicket.
However, No 10 Senanayake held his nerve with the pressure truly on, driving the third delivery he'd faced from the leg-spinner to the boundary rope to settle a see-saw contest.
Opener Shehzad had earlier hit eight fours in his 140-ball knock that provided the bedrock for Pakistan's competitive total.
After the early loss of opening partner Sharjeel Khan (seven) he combined with Mohammad Hafeez - fresh off a century of his own in the 11-run win in the previous match between the two nations - to put on 76 for the second wicket.
They cautiously progressed the score to 84 in the 20th over when Hafeez fell for 32, misjudging a second run to be caught well short by Karunaratne's throw from deep midwicket.
Sohaib Maqsood contributed 18 before he was well caught by Dinesh Chandimal off the bowling of Seekkuge Prasanna, leaving the score at 128-3 midway through the 29th over.
Skipper Misbah-ul-Haq joined Shehzad, who reached three figures with a single off the expensive Lasith Malinga (1-78), to put on a 103-run stand that increased the tempo.
Even when Sri Lanka did strike, Kulasekara trapping Shehzad leg before as he shuffled across his stumps, it only paved the way for Afridi to come in and belt 30 not out from a mere 15 deliveries, including two sixes.
Misbah ended up unbeaten 59 as he helped take 51 runs from the final 29 deliveries.
The two teams next face each other in the third ODI on December 22 in Sharjah. They then move on to Abu Dhabi for the final two matches, which take place on December 25 and 27.