That would have been worse if the Pakistani team has lost the match when they were in a good winning situation. Anyways the win is a win. no matter how it comes and it will bring confidence for them in the next match too. Now South Africa will be under pressure playing the do and die match to save the series in their home ground.
Good that Pakistan managed to win in the end. Else we would have seen a repeat of this:
The advantage for Pakistan was that South Africa chokes even more in such situations. The South African bowlers took 4 quick wickets and that put Pakistan in trouble. But after that they surprisingly gave away the advantage. One more wicket at that point could have changed the outcome of the match.