Fourth one-day international, Dubai:
Pakistan 275-9 (50 ovs) bt South Africa 274-6 (49.5 ovs) by one wicket
Pakistan's final-wicket pair scramble the winning run
Pakistan took the one-day international series with South Africa to a deciding match on Monday after a thrilling one-wicket win in Dubai levelled it at 2-2.
Graeme Smith returned to lead the South Africans and after opting to bat he hit 92 from 105 balls in his team's 274-6.
In reply, Younus Khan struck a patient 73 from 115 balls but when he edged on to his stumps with 55 needed from the final eight overs it looked all over.
But Zulqarnain Haider hit 19 not out as his side won off the penultimate ball.
When wicketkeeper Haider was joined by tail-ender Wahab Riaz, 31 were still needed from the final 23 deliveries, with eight wickets down.
Riaz survived a tough chance to Smith when he had only scored one, as the South Africa captain was unable to hold on to a top edge that descended from a huge height.
With 27 needed from the final 18 balls, paceman Dale Steyn drifted down the leg side and was clipped for four by Haider, with Riaz playing a similar shot for four more two balls later.
Four were needed from the final over, which was bowled by left-arm seamer Wayne Parnell.
Only a single had come from the first two deliveries and Riaz panicked, needlessly charging down the pitch in search of a single when Haider had played the ball straight back to the bowler, who duly broke the stumps before Riaz could regain his ground.
But to the relief of a frenzied crowd, Haider chipped two runs over mid-wicket - spared another run-out by a wayward throw - then pulled the next ball for the winning single to keep the series alive.
Veteran batsman Younus said: "We are working hard and you've seen that from the way we've played in the last three games. Hopefully we'll win this series."
Meanwhile, Smith blamed fielding errors for the Proteas' defeat, adding: "Throughout the 50 overs we weren't great in the field.
"Pakistan held their nerve in the end and it sets up a nice game on Monday."