Connect to share and comment
Tall left-armer Irfan took a career-best four for 33 in seven overs.
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.
The match was reduced to 44 overs a side but South Africa failed to see out the revised quota, 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 Africa top order.
He dismissed Hashim Amla and Colin Ingram off successive balls in the fifth over and followed up with the wickets of South Africa captain AB de Villiers and Faf du Plessis.
Irfan did not play in the first match in Bloemfontein last Sunday, which South Africa won by 125 runs.
He was selected for the second match in place of batsman Asad Shafiq.