There was no miracle in Malahide as Ireland's dream of becoming only the second team to win their first Test match was ended 10 minutes before tea.
A partnership of 120 between debutant Imam Ul-Haq and Babar Azam foiled the Ireland attack as Pakistan reached their victory target of 160 with five wickets to spare, but Ireland, rightly, walked off the field with their heads held high to a standing ovation from the fifth day crowd.
Trailing by 180 on first innings, Ireland had no right to even be contemplating victory on the final day - after all, only three teams in the history of Test cricket, 2,302 games before this one, had won after being asked to follow-on.
Indeed, only one of the previous nine inaugural Test matches had gone into the fifth day, but man of the match Kevin O'Brien's herculean effort on Monday ensured it would happen this time and three early wickets in the Pakistan second innings had Ireland daring to dream.
But it proved to be one innings too far for Ireland's limited attack with O'Brien exhausted after his batting efforts and Paul Stirling's occasional spin not used.
As a result, Tim Murtagh, who persuaded his captain to let him bowl 16 overs, and Boyd Rankin sent down all but three of the first 23 overs, either side of lunch, despite 38 runs coming off the first six after the break.
But Tyrone Kane, so much more effective with the new ball, despite being belatedly introduced, along with Stuart Thompson, forced Pakistan to fight all the way to the finish, the Eglinton skipper ending the century stand with a run-out and then taking his fourth Test wicket.
The biggest disappointment of the day came from the seventh delivery - O'Brien's first - when, still not fully focused, Ireland's Test centurion attempted to cut Mohammed Abbas but it went straight into the hands of first slip and hopes of the Irish getting a psychologically important 200-lead went with him.
Abbas followed up with the wicket of Rankin, who played on when attempting a leave, and then knocked over the stumps of Kane after the No.9 had batted for more than two hours and faced 96 balls.
It gave Abbas five wickets in a Test innings for the second time and nine wickets in the match, and confirmed the accurate right arm opening bowler as a major player in Pakistan's victory.
Pakistan had lost three Test matches without reaching 160 when batting fourth and when they were reduced to 14-3 in the fifth over, Ireland's odds of an historic first win had tumbled to 10/3.
Murtagh struck in the first over, an outswinger which Azhar Ali could only guide into the bucket hands of Stirling at first slip, Rankin followed up in his second over with the wicket of Haris Sohail, superbly caught low down by Ed Joyce in the gully, and when Murtagh bowled the experienced Asad Shafiq five balls later, Ireland were in dreamland.
In two of the last seven Tests when Pakistan had batted last, they had been bowled out for 36 and 42, but the chance of it happening again had evaporated by lunch when the tourists had reached 52 without further loss.
The decisive period in the chase proved to be those six overs after the break when also, fatally, Andrew Balbirnie dropped Babar. It was by no means an easy chance, diving to his right at third slip, but he got both hands to it and when it went down, it just felt that the chance of Ireland making history had gone down with it.
Sure enough, the fourth wicket pair did not offer another chance and it needed some reckless running - a feature of this match - for Ireland to make the breakthrough.
When Imam played the ball into the covers, Babar set off down the pitch but his partner had no intention of leaving his crease. Balbirnie swooped and although not the greatest throw, it was close enough to the stumps for Thompson to gather above his head and take off the bails.
When Thompson had Pakistan captain Sarfraz leg before with eight runs still required, there was a renewed effort in the Ireland ranks but three overs later Imam, fittingly, turned Kane through square leg for the winning runs and relief all round in the visitors' dressing room.
Next up for them is a two-Test series against England, starting on Thursday week at Lord's - the venue that Ireland are now one match closer to appearing at in their fledging life as the 11th Test nation. It will be no more than they deserve.
Pakistan 1st Innings 310-9 dec (Faheem Ashraf 83, Asad Shafiq 62, Shadab Khan 55, Haris Sohail 31; T Murtagh 4-55, S Thompson 3-62)
Ireland 1st Innings 130 (K O'Brien 40, G Wilson 33 not out; Mohammad Abbas 4-44, Shadab Khan 3-31)