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.
|Tiger Woods season in review: Tour Championship win caps remarkable comeback|
|49ers fear QB Garoppolo suffered torn ACL|
|World of golf is proud of Woods – Rose|
|WATCH: Tiger followed by incredible sea of fans at East Lake|
|Three takeaways from the 2017-18 PGA Tour season|
|Mbappe shows off signed Pele shirt|
|Tiger timeline: Woods´ fall and rise|
|Spieth´s breakthrough, Garcia´s Masters moment - Events between Tiger´s triumphs|
|Tiger Woods: I was close to tears on the last hole|
|Woods earns first win since 2013; Rose claims FedEx Cup|
|Pogba implores Manchester United to ´attack, attack, attack´|
|Valverde, Busquets and Vidal criticise Lenglet dismissal|
|Tiger Woods: The stunning statistics|
|Fitness hindering Dybala form, says Allegri|
|BREAKING NEWS: Woods claims first title since 2013, Rose wins FedEx Cup|
|Povetkin struggles leave Joshua with no Wilder fear|
|Guardiola targets Barca, Bayern dominance with Premier League priority|
|Centurions Rohit and Dhawan put India in final|
|Eagles top Colts as Wentz makes his return|
|Barcelona 2 Girona 2: Stuani brace punishes Lenglet red|
|Frosinone 0 Juventus 2: Ronaldo redeemed as champions extend perfect start|
|Gattuso: No alibis for two-faced AC Milan|
|Bangladesh hold on despite late Afghanistan charge|
|Composed Woods hits turn with five-shot lead|
|Chiefs´ Mahomes has another record-breaking Sunday|
|Saints QB Drew Brees passes Brett Favre for most career completions|
|Emery hints Leno may need patience after Cech display|
|Picamoles scores four as Montpellier batter 14-man Toulouse|
|Messi breaks LaLiga record|
|Worcester fend off prowling Tigers, Sarries go top|
|AC Milan 2 Atalanta 2: Last-gasp Rigoni rescues a point|
|Neymar keen to repay supporter affection|
|Pellegrini rues West Ham´s wastefulness|
|Paris Saint-Germain´s positive response buoys Tuchel|
|Lewis rekindles fond memories with Vilamoura triumph|
|Arsenal 2 Everton 0: Lacazette, Aubameyang extend winning streak|
|Stephens suffers as Osaka withdraws in Wuhan|
|Rhinos run riot to secure Super League status|
|Risk brings reward for victorious Marquez|
|Let´s have some fun - Wentz tweets message to Eagles fans ahead of return|
|Maybe in a year Chelsea will be at Liverpool´s level – Sarri|
|Under-pressure Rodgers bemoans ´bitty´ Celtic start|
|Slater should be banned for Grand Final - Fittler|
|Simon ends Bachinger fairytale to lift Metz title|
|Dominant Thiem reigns in St. Petersburg|
|Neymar hands young fan his shirt during Paris Saint-Germain victory|
|Quick-Step Floors storm to fourth time trial gold|
|Jorginho sets new passing record in West Ham draw|
|Rubiales slams ´crazy´ LaLiga schedule|
|Rennes 1 Paris Saint-Germain 3: Tuchel´s Ligue 1 record stays perfect|
|Why so serious? Joshua reveals Fury has blocked him on Twitter|
|West Ham 0 Chelsea 0: Sarri´s 100 per cent start comes to frustrating end|
|Marvellous Marquez reigns in Aragon yet again|
|Real Madrid will not go to the USA with LaLiga - Perez|
|Erasmus adds five players to Springboks squad|
|Barcelona snub ´hardest decision´ of Griezmann´s career|
|Perez pays tribute to Ronaldo and Zidane|
|Cazorla concedes Arsenal lacked self-belief under Wenger|
|Get King Kong for AJ! Joshua understands critics´ demands|
|Korea change sees Bertens take title in Seoul|
|I love Bilic, but I let him down – Arnautovic|
|He will never fight me! Fury hits out at ´ponderous´ Joshua|
|Azpilicueta convinced Hazard can be ´the best´|
|Wigglesworth´s career in Opta numbers as he breaks Premiership record|
|Ronaldo has nothing to prove, says Allegri|
|Federer shines as Europe hold narrow lead at Laver Cup|
|Astros, Yankees and Indians record dramatic wins|
|Pliskova too strong for Osaka in Tokyo final|
|Kyle Busch comes from behind to win again in Virginia|
|Dybala can play as a striker – Allegri|