Vernon Philander took two wickets in as many balls to leave Pakistan on 17 for two wickets at the end of the first day of the third Test after they had rallied earlier on Friday and bowled hosts South Africa out for 262.
Philander removed Shan Masood for two runs and then had Azhar Ali out first ball to bring to nine the number of wickets in a dramatic final session on what was supposed to be a docile wicket at the Wanderers.
South Africa, with a foundation of 90 runs from Aiden Markram and handy contributions from Hashim Amla, Theunis de Bruyn and debutant Zubayr Hamza, were 226-3 at tea but collapsed after and lost seven wickets for a paltry 33 runs as Pakistan's bowlers found reverse swing to seize the initiative.
But hopes of then capping a fine comeback with a solid start to their innings was spoilt by Philander.
Faheem Ashraf, one of three changes to the Pakistan side after losing the first two Tests, took 3-57 as South Africa crumbled after tea.
The hosts were 132-1 as Markram and Amla put together a 126-run partnership in an attacking start after stand-in skipper Dean Elgar had won the toss and elected to bat.
Markram's availability was only confirmed after a late fitness test but he showed no signs of discomfort from a thigh injury as he rushed to 78 not out at lunch. He looked set for a fifth test century before getting a slight touch to Faheem Ashraf's wayward leg-side delivery and being snagged behind.
Amla provided solid back-up and looked to be set for a big score himself before he was out for 41.
SCORES IN BRIEF
SOUTH AFRICA: First innings 262 all out (Markram 90, Amla 41, de Bruyn 49, Hamza 41; Amir 2-36, Abbas 2-44, Hasan 2-75, Ashraf 3-57)
PAKISTAN: First innings 17 for 2 (Imamul 10 not out; Philander 2-1)