Having already made headlines with his two wickets in the first innings, the 18-year-old leg-spinner became the youngest player in the history of men's Test cricket to take a five-fer on debut.
Ahmed finished Pakistan's second innings with figures of five for 48, with his first scalp being a vital one as he dismissed home captain Babar Azam to end a 110-run stand with Saud Shakeel that had threatened to give the hosts a lifeline in Karachi.
Babar's wicket sparked a collapse that saw Pakistan slump from 164-3 to 216 all out either side of tea on day three. That left England needing 167 for a 3-0 series win, and Ben Stokes' men raced their way to 112 for two by stumps.
Ahmed had said that making his debut was the best day of his life after being handed his Test cap on Saturday, but the teenager has now had to reconsider that assessment.
"Probably the best day of my life again. To get a five-fer on my debut is a dream come true, so yeah, it's great," he told BBC's Test Match Special.
He added: "Obviously I was thinking about it (five-wicket haul), I'd be lying if I said I didn't, but at the same time I just tried to forget it more, because the more that you chase a wicket, it won't happen.
"So it was nice to get a leg-spinning wicket as well."
Not only did Ahmed write his name into the history books as the youngest men's Test debutant to claim five wickets in an innings, he also easily surpassed the record for the youngest Englishman to take five in an innings.
Ahmed is more than two years younger than the previous England record-holder Bill Voce, who was aged 20 years and 177 days when he achieved the same feat in 1930.
It was the wicket of Babar that turned the momentum back towards England, but Ahmed was prouder of the ball that saw Mohammad Rizwan caught behind.
"I mean I bowled better balls to not get wickets, so just to bowl Babar Azam out is a dream come true, he's a very very good player," he said.
"I liked Rizwan's wicket because I've been working on my leg-spin quite hard for the last two months with Jeetan (Patel, England spin coach), so to get one to get it to spin a little bit the other side, it was great."
England's chase started in breathtaking fashion as the required total was rapidly reduced to 80 before Zak Crawley's dismissal for a run-a-ball 41 saw Ahmed surprisingly come in at number three.
However, he made only 10 from seven deliveries before being bowled by Abrar Ahmed, and looked furious with himself, hitting the bat on his way off the field.
"Stokesy just said 'get your pads on' and I was like 'perfect, it'll be a great day'," Ahmed said.
"Just 'try and finish it tonight' (was the message from the captain) so that was the plan. I think we would have as well if we had the last seven overs of the day."
England need 55 more runs to seal victory with Ben Duckett, who made 50 off just 38 balls, and captain Stokes (10) the not-out batters.