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.
|Messi: I´d give up Barca title for World Cup glory|
|LeBron reaching eight straight Finals is ridiculous and unbelievable – Stevens|
|Indians top Astros in 14 innings as Cole-Bauer duel turns into marathon|
|I´m squeezing this orange until there´s no juice left – LeBron|
|LeBron James leads Cavs past Celtics and into NBA Finals|
|Kyle Busch dominates to win Coca-Cola 600|
|Henderson still confident of Liverpool success|
|Sporting Kansas City 0 Columbus Crew 0: 10-man visitors battle to MLS draw|
|Inglis to captain new-look Maroons, Boyd and Scott axed for Origin I|
|Neymar labels Real Madrid links ´nonsense´|
|Koepka ready to turn seconds into wins|
|Rose ´really proud´ of Fort Worth Invitational win|
|Paul a ´game-time decision´ for series decider, says Rockets coach D´Antoni|
|Egypt president wishes Salah speedy recovery|
|Bonucci: Balotelli has matured|
|Ranieri backs Sarri to succeed at Chelsea|
|Konta admits to doubts after another early Roland Garros exit|
|Warriors´ Iguodala, Looney listed as questionable for game seven|
|Zverev batters Berankis, Goffin back from the brink in Paris|
|Rose cruises to victory at Colonial|
|Neymar: I´m not at 100 per cent yet|
|Toulouse confirm Ligue 1 survival with win over Ajaccio|
|I know what I´ve achieved - Bale not worried about plaudits as he looks to the future|
|Ostapenko ´angry´ after Roland Garros exit, Venus Williams falls at first hurdle|
|Barcelona B relegated to Spain´s third tier|
|Rayo Vallecano win promotion to LaLiga|
|Tarkowski leaves England camp for hernia surgery|
|Ramos ´quite clever´ but Salah injury not to blame for final defeat, insists Robertson|
|WATCH: Ricciardo takes wide receiver role on yacht for Tom Brady pass|
|Until next year – Ronaldo drops new future hint as Real Madrid celebrate with fans|
|Froome stunned by Giro triumph|
|The Triple Crown: Froome´s Grand Tour glory in numbers|
|Hannover sign Wimmer on season-long loan|
|Inter powerless to stop Icardi exit, admits Spalletti|
|Ashton makes England statement with Barbarians hat-trick|
|Watson masterclass seals third IPL title for Super Kings|
|Kozlova ends Ostapenko´s Roland Garros reign on day one|
|Imperious Zverev breezes into second round|
|Froome wins Giro d´Italia to complete Triple Crown|
|Stricken Salah confident over World Cup hopes|
|Verstappen highlights change in approach amid Rosberg criticism|
|Strinic claims three-year deal at Milan|
|Napoli captain Hamsik considering China offer|
|Chinese outsider Wang shocks Venus Williams in Paris|
|Redemption two years in the making - Ricciardo revels in Monaco glory|
|Flawless Molinari holds off McIlroy at Wentworth|
|Karius ´infinitely sorry´ but thanks Liverpool fans for support|
|Root and Bayliss dismiss ´outrageous´ fixing allegations|
|Giggs: Bale the best Welsh player I´ve seen|
|Ricciardo ends Monaco hoodoo despite mechanical issue|
|Lyon star Fekir denies being close to Liverpool switch|
|Pogba: I learned a lot from Abou Diaby|
|Where next for Real Madrid stars Ronaldo and Bale?|
|Shingler and Hewitt out of Wales tour|
|Kyrgios pulls out of French Open|
|Khan wants to bow out by winning blockbuster Brook fight|
|Is winter coming? Game of Thrones stars descend on Monaco|
|Root urges England´s batsmen to ´find a way´|
|Lovren, Van Dijk absolve Karius of blame|
|We all know where our nipples are - Hansen welcomes tackle trial|
|Rooney would thrive in MLS, says DC United boss|
|Pakistan complete demolition of sorry England|
|Curry, Durant reveal the secret to Thompson´s success|
|Salah will miss World Cup, claims Saudi sports administrator|
|Deschamps marvels at Zidane´s incredible Champions League success|
|FIA satisfied Ferrari ´inside the rules´|
|NSW Origin hopeful Moylan pulls the strings for rampant Sharks|
|Champions League blunders will stay with Karius - Clemence|
|Warriors assuming Iguodala won´t play game seven, Kerr says|
|Lampard confirms Derby talks over vacant managerial position|