Pakistan have booked their place in the T20 World Cup semi-finals and Babar Azam's team have the Netherlands to thank for doing them a huge favour at Adelaide.
They will play New Zealand in the first semi-final on Wednesday, with India and England to contest the remaining playoff on Thursday.
Pakistan made an inauspicious start to their Super 12 campaign, losing their tournament opener to arch-rivals India, followed by another last-ball loss to Zimbabwe.
By the time Pakistan registered their second victory against South Africa in a rain-truncated match at Sydney, their fate had slipped out of their own hands.
Their slim chances of making the last four depended on the Netherlands pulling off a giantkilling act against South Africa at the Adelaide Oval.
Much to their relief, the Dutch team did just that, eking out a 13-run victory that was their first against South Africa in any format.
After the Dutch side posted a competitive 158/4, Brandon Glover (3/9) led a lionhearted bowling effort to restrict South Africa to 145/8.
The result provided a lifeline for Pakistan, who then needed to beat Bangladesh in their final Super 12 game to move into the semi-finals.
Babar's team did precisely that, with a five-wicket victory to stay in contention for a second T20 World Cup title.
"We played pretty good cricket in the tournament," said Pakistan fast bowler Shaheen Afridi. "Even the two matches we lost, those were in the final delivery.
"We did not get the results we wanted, but there is no doubt that we played good cricket."
The Pakistan players watched on nervously, as the Dutch side stunned South Africa, who again lived up to their 'chokers' tag in global tournaments.
"We watched the game, it was a great result for us," said Afridi, whose 4/22 against Bangladesh earned him the player-of-the-match award. "But we know the result was not in our hand, so we were preparing for our game [against Bangladesh]."
Pakistan bowler Shahnawaz Dahani tweeted a couple of photos of Dutch cricketers, with a caption saying, "Friends in need are friends indeed".
Reuters
Join us at 9pm Wednesday for live updates of the T20 World Cup semi-final between the Blackcaps and Pakistan