Shadab Khan whipped the rug from under England's boots with an eye-popping 113, a blitz of boundary peppering when hope was lost, the one-wicket win guaranteeing Pakistan a place in the tri-series final. England, for the second time in three days, watched a sure thing swirl down the drain.
With Pakistan 154 for nine in their run-chase, 88 away from victory, queues were beginning to build at the Gaddafi stadium exits. But Shadab had other ideas, and with No 11 Haris Rauf providing adhesive company, went on the rampage. Balls disappeared over this boundary and that as England giggled nervously into their hands. The drama doubled when Shadab was given out lbw on 97, slamming his bat into the turf in frustration, hands shaken with England, before an inside edge was discovered on a what-the-heck review.
From there 21 were needed, and 21 were hit, nail-nibbling minutes encompassing Rauf arguing a Sam Curran wide with Will Jacks having to be placated by Joe Root, a first hundred in any international cricket for Shadab, and Rauf driving Henry Crocombe for four to win the game by one wicket. Their partnership of 89 was the highest for the 10th wicket in any successful ODI chase.
After the cut-throat chubbiness of Thursday's 859-run glut, this was pared down cricket. Pakistan, in West Indies World Series salmon pink for breast cancer, had looked in command at the halfway stage, after England left runs in the middle, all out with 20 balls to spare for just 241. But England's bowlers kept their nerve and Pakistan's batters faltered, until Shadab and Rauf's last stand.
Pakistan's chase had started under a purple Lahore night sky, with the ground filling up late. Like England earlier in the day, Pakistan had a tricky power play.
A frustrated Fakhar Zaman flashed a drive straight into the giant paws of Jamie Overton at slip in the fifth over to give the immaculate Gus Atkinson his first wicket.
Debutant Crocombe, all baggy shirt and rosy cheeks, coltish arms and legs working overtime, shared the new ball. He was on the money with his first over, and a more erratic nine-ball third finished with the wicket of Saim Ayub, who ladled the ball straight to Overton as Crocombe was mobbed.
The crowd had one name on its lips and Babar Azam, at his home ground, made them sing with a pure off-drive matched by something equally majestic on the on-side. But just as the glory hit the veins, Atkinson whistled through the gate, firing the top of off, wagging his finger in celebration.
Saad Baig picked up the pace with an otherworldly 32, until a bullet was collected by Jacks at backward point off Overton, who had pulled up in his delivery stride earlier in the over.

From there, it was cat and mouse, could England frustrate Pakistan into giving wickets away? Yes they could, as Liam Dawson and Overton bowled on a button, and finally Hasan Nawaz yahooed Dawson into the stratosphere, Harry Brook waiting for his prize. Arafat Minhas lasted just three balls before directing Overton to Root, who had just been ushered to short fine leg by Brook.
Salman Ali Agha had a meaty slog at Dawson, Razaullah, also on ODI debut, got a gorgeous ball from Jacks between bat and pad to leave Pakistan nine down. It looked like game over.
Earlier, Ben Duckett's fifth ODI century was the backbone of an England innings that sparked in places but was blotted by clusters of wickets. His second century at Lahore was dominated by sweeps of various hues, but after Pakistan won the toss and bowled, England's first four wickets lined up like a pin number: 4, 5, 1, 6.
Tom Banton clipped the superb Shaheen Shah Afridi's fifth ball to cover to give him a 150th ODI wicket. Joe Root had time, just, to dispatch Afridi to the boundary before leaning back and enveloping him to point.
Brook, fresh from 202 against Sri Lanka, was undone coming back for a second, fractionally too slow for an inspired Razaullah pick up and throw. Then Jordan Cox tried to nuzzle Rauf to third man but was met by Babar diving to his right at slip.
In Curran, Duckett at last found sticking power, and the pair added 93 until Shaheen brought himself back on and Curran (42) took on his shorter ball. As the pariah kites circled, England's last five wickets added 96, Duckett celebrating his first hundred against Pakistan with a low-key kiss of the badge, but they looked under-done and so it proved. To reach the final, England need Pakistan to beat Sri Lanka on Tuesday before thrashing Sri Lanka on Thursday.