Pakistan (310-9d & 160-5) beat Ireland (130 & 339) by five wickets.
For half an hour Ireland dared to dream: a great big, vivid, roller-coaster of a hallucination really, as Pakistan wickets fell and the thought of a stunning victory on the final day of the inaugural Test match looked on.
Set a target of 160 for victory after Ireland were rolled over quickly in the first session - Kevin O’Brien failing to add to his memorable century as he departed first ball for 118 - Ireland’s opening bowlers took out three of Pakistan’s top order in a 24-minute spell that had people in the stands doubting the reality of what they were watching.
To put it in context, only once in the 141-year history of Test cricket has a team playing their first Test won, and that was the very first game, when Australia beat England at the Melbourne Cricket Ground in 1877.
Add in the fact that on only three occasions previously has a team that was forced to follow on - as Ireland were after being bowled out for 130 in the first innings - gone on to win a Test match, one in each of the last three centuries.
Although the crowd was small at that stage of the morning, Ireland's supporters were making plenty of noise as Tim Murtagh took the new ball from the Dublin Road end, tasked with getting among the Pakistan top order.
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.
Haris Sohail scored Pakistan's first boundary off the final ball of the first over but he departed in Boyd Rankin's second over, when the left-hander failed to get on top of a back-foot shot, edging to Ed Joyce who took the catch low in the gully.
The second wicket fell with the scoreboard on 13 and they had only added one more run before Murtagh claimed his sixth wicket of the match with a pearler of a delivery that clipped the top of Asad Shafiq’s off-stump.
At 14 for three and with the opening bowlers’ tails up, there was a hum of anticipation in the ground that cricketing history could be made. A man who knows a thing or two about Test match history, veteran Pakistan journalist Qamar Ahmed - watching his 435th Test match in the last 44 years - described the match as “one of the most fantastic and absorbing” he has witnessed considering Ireland’s fightback.
The awakening from the dream was a slow one as Pakistan opener Imam-ul-Haq, making his Test debut, steadied nerves along with Babar Azam, the pair pushing the score on to 52 for three at lunch.
Babar was dropped on 13, when Andrew Balbirnie failed to hold on to a catch off Murtagh's bowling at third slip, and the fourth-wicket partnership went into three figures and got Pakistan within 20 runs of victory before the final act of a thrilling Test was played out.
Balbirnie helped run out Babar for 59 with an accurate throw to Stuart Thompson to whip off the bails, while Thompson completed his fine Test match by trapping Pakistan captain Sarfraz Ahmed LBW for eight. But Imam, showing the patience that his uncle Inzaman was famous for over his long Test career, finished unbeaten on 74 not out, hitting the winning runs off Tyrone Kane off the final ball of the 45th over, as the tourists wrapped up a five-wicket victory.
Afterwards captain William Porterfield praised his side's efforts over the four days, he said: "[I'm] extremely proud of how we went about it, all five days really. It's one of those, you always find it hard not to look at the little opportunities in the game here and there.
"It would have been nice to get an extra few runs this morning but at 14 for three, sitting there, we got a proper sniff against a quality line-up. If we could have got a couple more there, break that partnership a bit earlier then it's completely game on but how the lads acquitted themselves throughout the five days, I can't fault anyone at all."
The two sides posed together soon after for a photograph to mark the historic occasion, while Kevin O’Brien was awarded the man of the match award for his second-innings heroics with the bat.
Cricket Ireland have said that one or two Test matches a year will probably be the limit that the Ireland side will play. But after this wonderful four days of all that is good in the longest form of the game, they might like to revisit that number upwards.
Half an hour after play ended, the rain that might have earned Ireland a draw arrived in from the west. Too late, we were already back in Kansas.
SCORECARD
(at Malahide): Day 5 - Overnight: Pakistan 310-9 dec (96 ovs) (Faheem Ashraf 83, Asad Shafiq 62, Shadab Khan 55, Haris Sohail 31; T Murtagh 4-45, S Thompson 3-62, B Rankin 2-75), Ireland 130 (47.2 ovs) (K O'Brien 40, G Wilson 33no; Mohammad Abbas 4-44, Shadab Khan 3-31, Mohammad Amir 2-9) & 319-7 (122 ovs) (K O'Brien 118no, S Thompson 53, E Joyce 43, W Porterfield 43, T Kane 8no).
IRELAND Second innings
K O'Brien c Haris Sohail b Mohammad Abbas 118
G Wilson c Haris Sohail b Mohammad Amir 12
S Thompson b Shadab Khan 53
T Kane b Mohammad Abbas 14
B Rankin b Mohammad Abbas 6
T Murtagh not out 5
Extras (b1, lb20, nb2, w4) 27
Total (all out, 129.3 ovs) 339
Fall of wickets: 1-69,2-69, 3-94, 4-95, 5-127, 6-157, 7-271, 8-321, 9-332.
Bowling: Mohammad Amir 29.2-9-63-3; Mohammad Abbas 28.3-10-66-5; Rahat Ali 23-3-75-0; Faheem Ashraf 18-3-51-0; Shadab Khan 30.4-7-63-1.
PAKISTAN Second innings
Azhar Ali c Stirling b Murtagh 2
Imam-ul-Haq not out 74
Haris Sohail c Joyce b Rankin 7
Asad Shafiq b Murtagh 1
Babar Azam run out (Balbirnie/Thompson) 59
Sarfraz Ahmed lbw b Thompson 8
Shadab Khan not out 4
Extras (nb5) 5
Total (for 5 wkts, 45 ovs) 160
Did not bat: Faheem Ashraf, Mohammad Amir, Rahat Ali, Mohammad Abbas. Fall of wickets: 1-2, 2-13, 3-14, 4-140, 5-152
Bowling: T Murtagh 16-3-55-2; B Rankin 12-1-57-1; S Thompson 11-4-31-1; T Kane 6-1-17-0.
Pakistan won by 5 wickets.
Man of the match: Kevin O'Brien