Haris Sohail's brisk 89 put South Africa on the brink of their worst-ever World Cup as Pakistan racked up 308 for seven from their 50 overs at Lord's.
Defeat would end any chance of South Africa reaching the knockout stages of the World Cup, for just the second time in their history.
And the Proteas needed to equal their highest score from this tournament to keep their minimal semi-final hopes alive.
Ottis Gibson's side had only passed 300 once in their previous six matches, in their sole victory against Afghanistan.
The struggling Proteas were staring down the barrel of standing no chance of progression with two matches to play, with clashes against Sri Lanka and Australia potential dead rubbers from their perspective.
Haris' pivotal knock looked to hand Pakistan the edge at the interval, making a mockery of his first appearance in the tournament since his side's opening clash with the West Indies.
The 30-year-old hit nine fours and three sixes on his way to 89 from just 59 balls, a knock which injected much-needed impetus into the Pakistan innings.
Babar Azam posted 69, with openers Imam Ul Haq and Fakhar Zaman both notching 44.
Pakistan's top order once again failed to turn fine starts into big scores, leaving Haris to dig more seasoned performers out of trouble.
Imran Tahir proved the pick of the Proteas' bowlers, taking a smart two wickets for 41 runs, which meant he became the leading wicket-taker for South Africa in Cricket World Cup's.
Lungi Ngidi ended on three for 64 but those figures were massaged by two soft dismissals at the death.
Aiden Markram's removal of Mohammed Hafeez raised questions as to whether South Africa should have put more faith in spin sooner in this tournament.
Defeat here would certainly spell the post mortems on not just this World Cup, but also the current coaching staff and the reign of captain Faf Du Plessis.
Pakistan meanwhile were eyeing a victory that would keep alive their own slender semi-final chances.