Five balls later Pakistan were shell-shocked, the scoreboard remarkably reading 14 for three, as Murtagh took his second wicket of the day with the Ireland strike bowler sending an absolute corker down the track and straight through between bat and off stump, as Asad Shafiq was out for a solitary run.
The beaten Ireland captain William Porterfield is remaining positive: "It would have made for a very interesting game had lead got close to 200 runs and had we been able to break that partnership [between Imam-ul-Haq and Babar Azam] it could be a very interesting finish".
Earlier, Mohammad Abbas, benefiting from plenty of swing movement in overcast conditions, took the final three wickets of Ireland's second innings including O'Brien, who slashed at a wide one and edged to first slip.
But Imam-ul-Haq, like the whole Ireland team, also making his Test debut, led a Pakistan recovery although the match was still very much in the balance.
Hero of the fourth day, and Ireland's first ever centurion in Test cricket, Kevin O'Brien did not add anything to his overnight score as he was out caught in the slips for 118 off seamer Mohammad Abbas.
It took just four deliveries as Azhar Ali, who had been dancing down the wicket in a bid to put the Middlesex bowler out of his rhythm, nicked off to first slip where Paul Stirling took the catch.
Ireland will, naturally, look back on their first innings when they were bowled out for 130 as the key passage of play in the Test and ultimately that's what lost them the game, particularly when you consider how well they performed either side of the batting collapse.
Ireland added further points to bring their tally to 159 and 339 overall, leaving Pakistan with a 160 to reach.
But Thompson's single off all-rounder Faheem meant Pakistan would have to bat again, while Kevin O'Brien was looking increasingly assured. In addition, Pakistan enforced follow-on after 16 years.
Watch Pakistan's Test series in England live on Sky Sports Cricket, starting with the opener at Lord's from May 24.
Set a target of 160 to win in the final innings, Pakistan overcame early jitters to claim a comfortable victory in the end. Unfortunately, he came back after five years [out] and since he came back he has played every format for us.
The day didn't start as brightly for the Irish boys as they would've hoped. "And we were in that first innings, but to get to 340 shows the character in that changing room and the passion we have to play for our country".
This was a game to display the true folly of the ICC's exclusionary policy in Test cricket with Ireland showing that the game's oldest form could only benefit from fresh blood, that the sport is only dying out while its governing body allows it to.