South Africa will have to dig deep if they are to avoid defeat in the first test after being reduced to 72 for four wickets in their second innings, still trailing Pakistan by 121 runs, in Abu Dhabi on Wednesday.
With the wicket taking turn and Pakistan's spinners bowling an immaculate line, the world's number one test team showed signs of rust with both bat and ball in their first five-day match in eight months.
Having bowled the sub-continent side out for 442 just after tea on day three, South Africa reached 38 in their second innings before Alviro Petersen (17) was caught behind off the bowling of Mohammad Irfan to start a collapse that would see the side lose three more top-order batsmen for the addition of just another 34 runs.
Graeme Smith (32) was next to go as he was stumped at the second attempt by wicketkeeper Adnan Akmal to become Saeed Ajmal's 150th victim in tests.
Jacques Kallis, celebrating his 38th birthday, had a day to forget as he was trapped plumb lbw by Junaid Khan without scoring.
Pakistan completed their excellent day when Hashim Amla (10) was caught by Akmal off the bowling of Zulfiqar Babar to compound the misery for the visitors.
AB de Villiers (11 not out) and nightwatchman Dale Steyn (0 not out) will resume on day four.
Earlier, Misbah-ul-Haq scored his fourth test century to help Pakistan to a first innings score of 442.
The Pakistan captain bagged his first ton against the Proteas before he was out two balls later for exactly 100, lbw to Steyn.
He was ably supported by Asad Shafiq, who compiled a patient 54 from 104 balls and put on 82 runs for the fifth wicket with his captain before becoming JP Duminy's second wicket of the innings when he clipped the ball to Peterson at mid-wicket.
South Africa then made fairly light work of the tail, Saeed Ajmal struck a brisk 13 before edging a Vernon Philander delivery to wicket-keeper De Villiers, and Zulfiqar Babar was run out for two by Steyn with the last ball before tea.
Steyn picked up the last two wickets as he had Junaid Khan (3) caught by Morne Morkel and then bowled Akmal (32) with an excellent yorker.
Khurram Manzoor, who reached his maiden test century on Tuesday, was the only wicket to fall in Wednesday's opening session, caught behind for 146, as he slashed at a rising delivery from Philander and was taken at second slip by a diving Kallis.
The two-match series is being played in the United Arab Emirates due to security concerns in Pakistan.
(Reporting by Nick Said in Cape Town,; editing by Pritha Sarkar)
Our top photos from the last 24 hours.