Pakistan chased down a target of 275 with one ball to spare to claim a one-wicket victory over South Africa in the fourth one-day international and level the series at 2-2.
Zulqarnain Haider hit the winning run from the penultimate delivery of Wayne Parnell's final over at the Dubai International Cricket Stadium.
Younus Khan produced a gritty 73 at number three but his departure, bowled by Morne Morkel, was immediately followed by the run out of Abdur Rehman (0) to leave Pakistan suddenly in trouble at 220-7 in the 43rd over.
Morkel (3-48) added the scalp of Abdul Razzaq (33) before ninth-wicket pair Haider (19no) and Wahab Riaz (18) put on 28 from 20 balls - aided by the use of the batting powerplay for the final five overs - to turn things round for Pakistan.
Needing four off the final over, Riaz was run out from the third delivery with three still required.
With only last man Shoaib Akhtar for company, Haider brought the scores level with two to midwicket and then completed the run chase with a single from the next ball.
Opener Mohammad Hafeez (42), Younus and Asad Shafiq (36) had provided the initial impetus before South Africa put the squeeze on once the fielding restrictions had been relaxed.
It was the third nail-biting finish in a row, Pakistan having won the second match by one wicket and lost the third by two runs earlier in the week.
The series decider takes place at the same venue on Monday.
Graeme Smith's 92 had earlier provided the foundation for South Africa's total of 274-6 after they opted to bat first.
Smith, returning to lead the side after missing the second and third games with a hand injury, struck nine fours during his 105-ball contribution.
He shared a third-wicket stand of 92 with AB de Villiers before providing part-time spinner Mohammad Hafeez (2-37) with his second wicket, trapped lbw.
De Villiers was removed by paceman Shoaib (2-51) one short of a half-century having failed to find the boundary in 70 deliveries of crease occupation.
But cameos from JP Duminy (36), Colin Ingram (27no) and Johan Botha (28no) powered the Proteas well beyond the 250 mark.