Pakistan was sent into bat by South African captain Graeme Smith and started disastrously falling to 4-33, but since then Younis Khan and Asad Shafiq both scored terrific fighting centuries to take the tourists to 5-253 at stumps on Day 1.
South Africa ended up comfortably winning the First Test of the series in Johannesburg by 211 runs, but Pakistan started strongly on the opening day bowling the Proteas out for 253 and then being 0-6 in reply at stumps.
However, Pakistan then crumbled to be all out for its lowest ever Test score of 49 to then always be in a position where it was only ever a matter of how much it would lose the match by.
Now at stumps on Day 1 at Newlands, Pakistan again is in a position where it can put itself in a strong position on the second day with a solid finish to the first innings, and then with some good bowling at South Africa early on.
Smith won the toss expecting his incredible bowling attack to be able to extract plenty of life out of the Cape Town wicket and that's exactly what they did throughout the first 20 overs of the day.
Vernon Philander was the first to strike when he had Nasir Jamshed caught behind by AB de Villiers for three with the score 1-10.
Pakistan was then 2-21 when fellow opener Mohammad Hafeez was caught at slip by Smith off Dale Steyn for 17.
It then only continued to worsen for the tourists when Azhar Ali (4) and captain Misbah-ul-Haq (0) were both out in the same Morne Morkel over.
That brought Khan and Shafiq together with the score at 4-33 and it appeared another Pakistan batting collapse could be on the cards, but the pair showed tremendous grit and courage, and then some flair and shot-making ability to get their country out of trouble.
Khan and Shafiq combined for a 219-run partnership from 429 balls with both players bringing up centuries along the way.
Both players took a particular liking to the left-arm orthodox spin bowling of Robin Peterson with Khan scoring 39 from 42 balls, including three sixes, off him and Shafiq 46 from 72 with six fours and a six also.
Eventually, though, just two overs before stumps the partnership was broken when Khan was caught behind off Philander for 111 from 226 balls with his knock including seven fours and three sixes.
It was the 35-year-old's 21st Test century and fourth against the Proteas but first in South Africa. Impressively, 16 of his 21 Test centuries have come outside of Pakistan.
Shafiq remains not out overnight, though, on 111 with Sarfraz Ahmed having joined him and having just faced five balls without scoring a run.
Morkel has taken 2-37 for South Africa with Philander picking up 2-45 and Steyn 1-34. Peterson has had no luck going for 0-85 in 19 overs.
South Africa has come into the Test with the same side that won so convincingly in Johannesburg, but Pakistan has changed around its bowling line-up with 7'1 debutant left-arm quick Mohammad Irfan and another left-armer Tanvir Ahmed both coming in for Junaid Khan and Rahat Ali.