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.
|Hulkenberg proud to survive in F1´s pay driver era|
|It´s here, it´s real, get on with it - Dyche dismisses Europa League excuse|
|Grujic agrees Liverpool extension, joins Hertha on loan|
|Martial starts as Lukaku, Young return for Manchester United|
|Fury-Wilder to be staged in November or December - Warren|
|Manchester City 6 Huddersfield Town 1: Aguero hits hat-trick as champions triumph|
|Burnley 1 Watford 3: Hornets end away day woes as Deeney leads destructive display|
|McFarland cleared to leave Scotland and join Ulster|
|Simeone wants ´only the best´ for Filipe Luis amid PSG links|
|PSG signing Boateng rated ´50-50´ by Bayern president|
|Cipriani a positive influence, insists Gloucester head coach|
|Bayer Leverkusen´s Bailey signs contract extension|
|Jesus and Aguero start for City as Mahrez misses out|
|Federer unsure what to expect from Djokovic duel|
|Chievo goalkeeper suffers broken nose, whiplash in Ronaldo collision|
|Simmons lauds influence of ´big brother´ LeBron|
|PSG´s Cavani selected by Uruguay as Coito fills in for Tabarez|
|Starc leads tributes after ´leader of the pack´ Johnson retires|
|Hazard confirms he is staying at Chelsea this month|
|Liverpool´s Firmino dreaming of Premier League title glory|
|Raiders rock the Roosters as NRL´s top-four battle hots up|
|Erasmus demands improved Springboks|
|Athletics pull even with Astros in AL West|
|Mercurial quick Johnson retires from cricket|
|MLS Review: Royer leaves it late for Red Bulls, Dallas bounce back|
|Crotty concussed, Folau injured|
|DFB president Grindel sorry Ozil felt ´deserted´|
|Busch picks up first win of season in Night Race|
|NASCAR results at Bristol: Kurt Busch picks up first win of season in Night Race|
|Woakes welcomes back ´big-game player´ Stokes|
|´Genius´ Messi still amazes Valverde|
|All Blacks, Springboks await Namibia at Rugby World Cup|
|Federer to face Djokovic after Goffin withdraws|
|Rain halts plays at Wyndham Championship|
|De Gea will extend contract soon, says Mourinho|
|Halep to meet Bertens in Cincinnati final|
|Frampton set for Warrington fight after dominant Windsor Park win|
|Messi makes LaLiga history with Barcelona´s 6000th goal|
|MC Alger defeat throws quarter-final chase wide open|
|Barcelona 3 Deportivo Alaves 0: Messi´s milestone goal sets up victory|
|Djokovic on course for Masters 1000 history after Cilic victory|
|It´s on! - Wilder fight confirmed after Fury defeats Pianeta|
|Like Cruyff before him, Guardiola favouring Foden´s style over substance|
|Ronaldo tweets debut delight after Juve win|
|Chelsea are not title contenders yet, claims Sarri|
|Bayern Munich boss Kovac planning for Boateng stay|
|Championship Review: West Brom crush QPR as Leeds stay perfect|
|Allegri pleased with Ronaldo despite goalless Juventus debut|
|Chelsea can produce magic with Sarri in charge - Hazard|
|Emery ´happy without the result´ as Arsenal comeback falls short|
|Gordon confirms Cleveland Browns return|
|Eight shots and only 30 passes - Ronaldo´s Juventus debut in Opta numbers|
|Cristiano Ronaldo´s debuts: Best impressed, scoring a penalty & a blank for Juventus|
|Old boy Escare haunts Catalans in big Wigan win|
|Preston North End 2 Stoke City 2: Super sub Crouch salvages a point|
|Pochettino vows not to discuss Alderweireld future before five-minute answer|
|Waring, Aiken lead the way as Olesen stays in the hunt|
|Linking play, forcing saves and clashing with goalkeeper - Cristiano Ronaldo´s Juventus debut|
|Chelsea 3 Arsenal 2: Alonso snatches win after Gunners comeback|
|West Ham still haunted by last season - Pellegrini|
|Puel defends Vardy after Wolves red card|
|Chievo 2 Juventus 3: Ronaldo´s debut ends in dramatic win|
|Mbappe: Neymar is Paris Saint-Germain´s superstar|
|Pickford should have seen red - Hughes fumes over challenge on Ings|
|Kohli and Rahane star as India edge day one|
|AC Milan´s Strinic sidelined by heart problem|
|Kane happy to banish August goal hoodoo|
|Guingamp 1 Paris Saint-Germain 3: Mbappe returns to inspire comeback|
|Springboks´ second-half revival punishes Pumas|
|Finally! Kane scores a Premier League goal in August|