Connect to share and comment
Tall left-armer Irfan took a career-best four for 33 in seven overs as South Africa were bowled out for 191 in a match reduced to 44 overs a side.
Pakistan achieved victory with 4.4 overs to spare, captain Misbah-ul-Haq anchoring his side's chase, making 57 not out.
The win levelled the five-match series at 1-1 after South Africa had cruised to a 125-run win in Bloemfontein last Sunday.
South Africa crashed to 62 for five under Irfan's onslaught but recovered to reach 177 for seven after 38.4 overs when a violent thunderstorm struck the ground and caused a stoppage of almost two-and-a-half hours.
South Africa failed to see out the revised quota of 44 overs, losing their last three wickets for 12 runs to be bowled out with four balls to spare.
Farhaan Behardien led the South African fightback, making a measured 58 off 82 balls for his maiden international half-century.
Robin Peterson made 44 and helped Behardien put on 67 for the seventh wicket before Behardien was caught on the midwicket boundary one ball before the stoppage.
Irfan, the tallest player in international cricket, gained steep bounce as he ripped through the South African top order.
He dismissed Hashim Amla and Colin Ingram off successive balls in the fifth over and followed up with the wickets of South African captain AB de Villiers and Faf du Plessis.
After Irfan had made his inroads, slow bowlers Saeed Ajmal, Mohammad Hafeez and Shahid Afridi kept the pressure on.
Ajmal took two for 23 and Hafeez two for 35, while Afridi conceded only 24 runs in eight overs.
Pakistan had a brief wobble when they slipped to 69 for three in the 15th over, with Hafeez and Kamran Akmal falling in successive overs.
But Misbah and Younis Khan, the side's most experienced players, steadied the innings with a fourth wicket partnership of 46 off 67 balls.
Shoaib Malik joined Misbah and they added an unbeaten 77 off 82 deliveries, with Malik contributing an aggressive 35 not out off 75 balls.
Misbah's 57 runs were made off 75 balls with three fours and three sixes.