Rassie van der Dussen hit an unbeaten 101 off 51 balls as the Proteas beat Pakistan by six wickets in their T20 World Cup warm-up match on Wednesday.
Needing 19 to win off the last over, Van der Dussen smashed a six off the first ball and then took a single.
David Miller then cleared the boundary and took a single, before Van der Dussen struck two fours off the last two balls to snatch a remarkable win.
The Proteas had been in trouble at 15-2 after three overs, losing both openers Quinton de Kock (6) and Reeza Hendricks (7).
But Van der Dussen and Temba Bavuma (46 off 42 balls) got them back on track, and Heinrich Klaasen (14 off eight) and Miller (8* off three) played their part at the end.
Earlier, Pakistan posted 186-6, with Fakhar Zaman making 52 off 28 balls before retiring out.
Kagiso Rabada was the Proteas’ best bowler, taking 3-28 in four overs.
The Proteas will play Australia in their first Super 12 match of the T20 World Cup on Saturday.