South Africa were on target to clinch their Test series against Pakistan after a second successive day of tumbling wickets at Newlands on Saturday.
South Africa were 36 for two at the close on the second day of the third and final Test after being set to make 161 to win, with captain Graeme Smith unbeaten on 33.
Leg-spinner Danish Kaneria took both wickets for two runs, having Boeta Dippenaar caught behind for three before trapping nightwatchman Paul Harris leg before in the last over.
Seventeen wickets fell for 274 runs during the day, with South Africa bowled out for 182 in their first innings after resuming at 131 for five before Pakistan were dismissed for 186 in their second innings.
Wicketkeeper Mark Boucher hit an aggressive 40 not out to take South Africa to a 26-run first innings lead which could yet prove crucial on a pitch which has helped both seam and spin bowlers.
Fast bowler Dale Steyn, after helping Boucher add 43 for the ninth wicket, took three for 47 in Pakistan's second innings, dismissing both opening batsmen and Pakistan captain Inzamam-ul-Haq.
Pakistan were only 95 ahead when Inzamam was seventh man out but tailenders Mohammad Sami and Shahid Nazir put on 55 for the eighth wicket to give their team an outside chance and ensure that the match would go into a third day.