Ireland's historic Test debut ended in a five-wicket defeat, but only after they had given Pakistan a major scare on the final day at Malahide.
The tourists ultimately prevailed with a degree of comfort, reaching a target of 160 thanks largely to Imam-ul-Haq's unbeaten 74 and 59 from Babar Azam.
However, Pakistan had crumbled to 14-3 in Tuesday's morning session, raising the prospect of a stunning Ireland victory after the hosts had been made to follow on.
Mohammad Abbas finished with a five-for and match figures of 9-110 as Ireland were dismissed for 339 having resumed on 319-7, the dangerous Kevin O'Brien failing to add to his overnight score of 118.
Pakistan's subsequent wobble left the match fascinatingly poised, but Imam and Babar restored order and the chase was completed before tea, allowing Pakistan to look ahead to facing England, while Ireland reflect on a promising first venture into the Test arena.
Pakistan have won by 5 wickets. We may not have got the win, but it was a fantastic effort from every one of our team on a historic occasion. They’ve done us proud.— Cricket Ireland (@Irelandcricket) May 15, 2018
Thank you @TheRealPCB for a fantastic Test match.#IREvPAK #BackingGreen pic.twitter.com/9cSBRpOKk7
O'Brien's hundred, which will go down in the history books as his country's first in this format, kept Ireland alive on day four, but he departed to the first ball he faced on Tuesday, edging Abbas to Haris Sohail at slip.
Abbas swiftly removed Boyd Rankin (6) and Tyrone Kane (14) to return second-innings figures of 5-66.
Ireland fought back superbly, though, taking three quick wickets to bring the contest to life.
Tim Murtagh had Azhar Ali (2) caught at first slip and bowled Asad Shafiq (1), either side of Sohail (7) departing to an excellent Ed Joyce catch in the gully off Rankin.
However, debutant Imam and Babar maintained their composure to combine for 38 runs before lunch and their alliance continued well into the afternoon after the latter was dropped by Andrew Balbirnie off Murtagh on nine.
Babar was eventually run out by Balbirnie and Pakistan captain Sarfraz Ahmed (8) fell lbw to Stuart Thompson, but the second Ireland rally came too late and top-scorer Imam fittingly contributed the winning runs.
|Madrid squad great and humble - Solari responds to Ronaldo|
|Langer unsure what to expect from Perth wicket|
|Fournette subjected to alleged racial abuse in Titans loss - Marrone|
|Better and better - Mbappe hails Neymar link|
|It´s the end of one of the best movies you could ever see - James pays tribute to retiring Wade|
|NASA invites Curry to see moon rocks|
|No plan B for LaLiga Miami game after Barcelona withdrawal|
|Messi´s English haul, Neymar eyes hat-trick record - Champions League in Opta numbers|
|LeBron trumps Wade in last dance, Curry scores 38 points|
|Seahawks secure dominant win over Vikings|
|Iniesta visits Messi and former club Barcelona|
|Drake makes plea for ball thrown into stands after Miami miracle|
|´Toughest pretty boy I´ve ever met´ - Langer dismisses Paine concerns|
|Van Dijk says Liverpool can challenge for double ahead of Napoli decider|
|Hazard: I´ve always loved Real Madrid|
|Yankees interested in Machado, not Harper - Cashman|
|Warriors´ Curry believes moon landing was faked|
|76ers star Butler suffers strained groin|
|Brady: Patriots still have a lot of football to play|
|´No one died´ - Belichick´s message to Patriots after stunning loss|
|Silva lauds Digne after stunning free-kick|
|Aduriz joins Messi, Ramos in LaLiga history books|
|We have a plan - Ravens coach Harbaugh prepared for Flacco return|
|´It´s difficult to accept´ - Gracia calls for introduction of VAR|
|LaLiga press on with overseas match plan despite Barcelona withdrawal|
|PSG open Coupe de France defence at fifth-tier Pontivy|
|Hazard backs Sterling as Neville reveals England star´s Euro 2016 concerns|
|Everton 2 Watford 2: Digne salvages draw with 96th-minute free-kick|
|Barcelona could ´steal´ Kane, says Pochettino|
|Oakland Raiders fire general manager McKenzie|
|Struggling Villarreal appoint Garcia Plaza as Calleja successor|
|Warriors assign Cousins to G League team|
|Barcelona pull out of plan to play LaLiga game in Miami|
|Pochettino to keep an eye on Inter when Spurs face Barcelona|
|Pochettino confirms Walker-Peters set to start against Barcelona|
|Denver Nuggets add free agent Young|
|Topping Group A no magic wand for an easy knockout draw, says Simeone|
|The cake has been made, now we need the cherry - Ancelotti targets repeat at Anfield|
|Lloris braced to face ´one of the best in history´ in Messi|
|Tuchel expects Neymar to face Red Star|
|Foden signs Manchester City deal to 2024|
|It happened to me! - Valverde laughs off Dembele timekeeping|
|´Projecting´ an Argentina return? Messi met with AFA president and Scaloni|
|Erasmus expects to leave head coach role after World Cup|
|Chelsea issue suspensions pending investigation into Sterling incident|
|Kane is extraordinary – Valverde hails reported Barcelona target|
|Man behind Naomi Osaka´s rise wins WTA Coach of the Year|
|England name unchanged Test squad as Willey returns for West Indies ODIs|
|Spalletti: No issue with Icardi watching Superclasico in Madrid|
|Klopp confirms 2013 talks with ´chatty´ Napoli president De Laurentiis|
|Sri Lanka spinner Dananjaya suspended due to illegal action|
|His reaction was just brilliant – Klopp praises Sterling for response to abuse|
|Gomez renewal a ´smart decision´ for both parties – Klopp|
|Magnificent Molinari named European Golfer of the Year|
|Barcelona best option for Frenkie de Jong, insists midfielder´s father|
|Gronkowski on Miami Miracle: ´Got to make that tackle´|
|Tottenham youngster Walker-Peters signs on until 2023|
|Juventus ´more of a family´ than Real Madrid - Ronaldo|
|Kingsley Coman contemplates retirement if injury nightmare continues|
|McVay ´sick´ over offensive failings as Rams coach takes blame for loss|
|Calleja axed as Villarreal coach|
|Kenyan Drake on Miami Miracle: I couldn´t let Gronk tackle me!|
|Ronaldo: I deserved Ballon d´Or, the numbers don´t lie|
|Rugby Australia to make Cheika decision this month|
|England defender Gomez signs new Liverpool deal|
|Ronaldo wants to see Messi follow him to Italy|
|Neymar happy to play in any position for PSG - Draxler|
|Paine insists he is ´fine´ after taking blow to finger|
|Ponzio: River players will be ´idolised´ for Libertadores success|
|Champions League permutations: How Inter, PSG and Liverpool can progress|