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.
|Benitez tells FA to examine Zaha red card comments|
|Bjorn unsure of future after Ryder Cup|
|Tebas still optimistic over Girona-Barcelona in Miami despite RFEF setback|
|Emery promises more chances for frustrated Leno|
|Cahill considering Chelsea departure in January|
|Kaepernick to receive Harvard´s highest honour in African, African-American studies|
|Defending champion Ostapenko dumped out of Korea Open|
|Mourinho is an inspiration - Nuno|
|Witty Wilson ´delighted´ to be praised for Fisher heroics while sitting on couch|
|Burns, Denly and Stone in England squad for Sri Lanka Tests|
|Aspas reveals interest from Real Madrid, Atletico|
|Arsenal´s Mkhitaryan a doubt for Everton match|
|Klopp demands Liverpool ´stay angry´ against Southampton|
|Long-serving Tabarez signs four-year Uruguay extension|
|Injured Mendy ruled out of Cardiff trip|
|Douglas Costa out up to a month with ankle & thigh injuries|
|Slater shrugs off Feki hit amid Grand Final suspension concerns|
|Crisis? What crisis? Klopp unconcerned by Salah form|
|I didn´t convince him, he decided for himself - Guardiola says thanks to Aguero|
|Leno frustrated by Arsenal bench role|
|Joshua almost 2st heavier than Povetkin for Wembley bout|
|From salvation to the record books - Fisher revels in European Tour´s first 59|
|Lahm says Germany best for Euro 2024 as UEFA publishes report|
|Lopetegui backs Modric over Ronaldo for individual prizes|
|Goretzka to start against former club Schalke, confirms Kovac|
|Fisher shoots first 59 in European Tour history|
|Simeone defends Ronaldo after controversial Champions League red|
|Slater sees Storm into Grand Final, awaits fate over ´shoulder charge´|
|Hogg to miss Scotland´s November Tests following ankle surgery|
|Osaka through as Azarenka and Garcia crash out|
|Burgess weighing up legal options after being cleared in Rabbitohs investigation|
|Uncapped Cottrell and Gordon named in Wallabies squad|
|He´s done fantastic work - Mourinho hails Wolves boss Nuno|
|Joshua v Povetkin: No need for fireworks on AJ´s Wembley return|
|Six titles, 204 goals - Aguero´s incredible City career in Opta stats|
|Read to miss Argentina clash, Ioane brothers sign new deals|
|Pedro allays injury fears after Europa League clash|
|Dilly dilly to all the Cleveland fans! Mayfield promises further Browns success|
|Manchester United ´hell´ left Zaha depressed|
|Jackson hesitates in naming Mayfield as Browns´ starting QB|
|LeBron congratulates Browns for ending 635-day winless streak|
|Aguero Extension: 10 of the best goals from the Manchester City star|
|Aguero signs City contract extension until 2021|
|Stress from drink-driving charge may have contributed to Lloris injury – Pochettino|
|CBF backs Cruzeiro´s Dede appeal and suggests VAR investigation|
|The big Friday Premier League quiz|
|Red Sox clinch AL East with win over Yankees|
|Brighton star Knockaert reveals battle with depression|
|Bud Light beer fridges open after Browns snap 19-game winless streak|
|Browns end 635-day drought with first win since 2016 after downing Jets|
|Blue Jays overturn 8-2 deficit in improbable ninth-inning comeback|
|Colo Colo 0 Palmeiras 2: Scolari´s men poised for Libertadores SFs|
|Tour Championship would enhance successful year, says Tiger|
|Pogba: Man United getting better after winning run|
|What bothers me is that he has time to even do that – LeBron responds to Trump tweet|
|Cowboys most valuable NFL team for 12th successive year|
|Mkhitaryan aiming for glory with Europa specialist Emery|
|Sarri: Pedro´s injury is not too serious|
|This Week in U.S. Sports: Drama in Minnesota, a Judge returns and tragedy in Iowa|
|Tottenham will overcome rough patch – Lamela|
|Torreira impresses for Arsenal but leaves with knock|
|Gattuso urges Higuain to be less predictable with his movement|
|Steelers´ Brown: ´Obviously I don´t want to be traded´|
|Woods, Fowler share Tour Championship lead|
|LeBron James backs Serena Williams after US Open controversy|
|Thiem into St Petersburg quarters, but retiring Youzhny bows out|
|Wigan clinch home semi-final with win over Huddersfield|
|Can apologises following sexism accusations|
|De Bruyne expects to be back for Manchester derby|
|Celtic 1 Rosenborg 0: Griffiths late show lifts Hoops|