The Pakistanis were expected to follow their capitulation in the previous two Tests and be cleaned up on day three of the third and final match by a rampant England pace attack.
But Pakistan finally flexed their batting muscle to be dismissed for 449 in the last over of the day, snatching an unlikely lead of 129 runs to force a fourth day of action nobody predicted.
England will still be expected to knock off the 130 runs they'll need on Saturday to complete a first three-Test whitewash since 2024 on the same ground against the West Indies.
Gutsy half-centuries by Shan Masood (95), captain Babar Azam (76) and opener Azan Awais (59) lifted Pakistan to the brink of wiping out a 320-run deficit on the first innings.
But then Razaullah, a feisty 21-year-old paceman who'd battled hard to take four wickets when England batted, grabbed his moment along with No.10 Mohammad Abbas as they put together a breathtaking late-day century partnership for the ninth wicket.
Razaullah, who has a first-class century, hammered nine sixes, equalling the most ever clouted in a Test innings in England when Ben Stokes smashed the Australian attack in the 2023 Ashes clash at Lord's.
His first six gave Pakistan the lead and he hit three in an over off Gus Atkinson. His fifth six off Jofra Archer got him a 43-ball fifty, while his next bravado straight maximum off England's quickest strike bowler took Pakistan past 400.
Abbas was out for a career-best 42, including two sixes and five boundaries, ending an entertaining partnership of 121 from 123 balls, the highest ninth-wicket stand against England since 1984.
The confident Razaullah beamed: "They bowled in the slot, so I was eyeing it up. I am enjoying it thoroughly. There was no point I was scared."
He raised his half-century with a six, reaching the milestone in 43 balls, the fastest fifty by a Pakistan batter on Test debut.
He received a standing ovation when he was finally stumped for 81 off just 63 balls, which left him hugely frustrated only moments before scheduled stumps.
Razaullah had operated at 90mph when England batted and dismissed captain Joe Root in his first Test over, toiling wholeheartedly throughout 23 overs to finish with 4-148.
"He's been very impressive," said England's interim coach Marcus Trescothick. "Not just with his batting. You want to see characters like this and young players coming through into the game with a bit of something about them.
"He's got pace, he's at it on the field and then he slogs it like that. That's pretty good to see. Fair play because some of the sixes he hit were pretty impressive to watch."
England started the day expected to wrap up another innings win in quick time but Pakistan, who were 0-2 in the first over on Thursday evening, breached 200 after lunch, 300 after tea and went on to make 397 runs in all in 84 overs on Friday, including their first two century partnerships of the tour.