Hashim Amla (98) and AB de Villiers (74) took South Africa to the brink of victory but South Africa could score only seven runs off the last nine balls, while losing two wickets.
Set to make 263 to win, they finished on 261 for six.
Misbah admitted that a win seemed unlikely with two overs to go. He said: “But there is always pressure on the side batting second. We knew that we would have a chance if we had one good over so that South Africa needed more than a run a ball in the last over, especially if they had new batsmen at the crease.”
The good over was provided by off-spinner Saeed Ajmal, who conceded only two runs in the penultimate over and finished with the wicket of Amla, caught at deep square leg going for a big hit.
Junaid Khan had JP Duminy caught in the deep off the second ball of the final over during which he conceded only three singles before the last ball went for four leg byes.
“It really means a lot to us to beat South Africa in a bilateral series for the first time, especially doing it in South Africa,” said Misbah.
It was especially satisfying because Pakistan were recently beaten 4-1 by the same opponents in the United Arab Emirates.
“It is a young side and now they believe they can win. That was what was lacking (in the previous series),” said Misbah.
In a match reduced to 45 overs a side by morning rain, South Africa had fallen well behind the required run rate when De Villiers joined Amla.
De Villiers slammed 74 off 45 balls as he and Amla put on 110 off 78 deliveries to reduce the chase to less than a run a ball. But De Villiers played one audacious shot too many to be caught at deep backward square leg after slamming 74 off 45 balls.
De Villiers struggled to explain yet another failed run chase by his team, who have now lost their last seven matches when batting second.
“I had the game in my hands with Hash out there with me,” he said.
“I’ve finished a lot of games like that before and I was on a bit of a roll there. I should have caught my breath a little bit and looked at the situation again. It is very disappointing.”
Opening batsman Ahmed Shehzad was named man of the match. He made 102 after Pakistan were sent in to bat under heavily overcast skies.
Fast bowler Dale Steyn took a career-best six for 39, including two wickets in the last over of the innings, but the other South African bowlers struggled to contain their opponents, who won the first match in Cape Town by 23 runs on Sunday.
Shehzad, 22, hit eight fours and two sixes in a 112-ball innings which ended unhappily when he hit the ball to mid-on and set off for a run before being sent back by batting partner Umar Akmal.
He could not beat Imran Tahir’s throw to wicketkeeper Quinton de Kock and gestured angrily at Akmal.
The dismissal came off the last ball before the compulsory batting power play, which was taken after 35 overs.
Shehzad, who made his first-class debut aged 15, shared a third wicket stand of 124 off 134 balls with Sohaib Maqsood, who made 42 off 59 balls.
The pair came together after Steyn had snared two early wickets, bowling Nasir Jamshed and extending his ascendancy over Mohammad Hafeez, who he had caught behind. It was the 15th time Steyn had dismissed Hafeez in international matches.