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.
|Kovac relieved by Bayern´s timely victory|
|Strasbourg 2 Monaco 1: Sy howler and Grandsir red card cost Henry in first match|
|Leicester City defender Chilwell signs new six-year contract|
|PSG´s Tuchel hopes Verratti and Di Maria can face Napoli|
|Liverpool star Salah had no fear during scoring drought|
|Alonso´s 2019 plans not damaged by McLaren´s IndyCar decision|
|Edinburgh outclass troubled Toulon, Wasps and Bath play out thrilling draw|
|Barca concern as Messi substituted with worrying arm injury|
|Howe: South coast derby draw a fair result|
|Our heads were in Manchester – Allegri left fuming at Juventus´ loss of focus|
|Derby County 2 Sheffield United 1: Marriott blunts Blades with 77th-minute winner|
|We have so many problems – Jokanovic alarmed by Fulham defensive woes|
|Huddersfield Town 0 Liverpool 1: Salah snaps winless streak|
|Pellegrini ruing injuries after Yarmolenko hurts ankle|
|Villarreal 1 Atletico Madrid 1: Simeone´s side denied LaLiga top spot|
|Gracia: Not easy to dominate Wolves like that|
|Isner´s Finals hopes hindered by Stockholm defeat|
|Dyche incredulous at refereeing decisions in Man City thrashing|
|Juventus 1 Genoa 1: Champions´ winning run ends despite record Ronaldo goal|
|´Fantastic´ Lamela urged to find consistency by Pochettino|
|You don´t want to lose any players - Young speaks out on Wade NFL speculation|
|Championship Review: Smith gets off to a winning start, Leeds beaten|
|Guardiola hails extraordinary Fernandinho after Burnley drubbing|
|Pochettino lauds Lloris as one of world´s best after West Ham heroics|
|Paris Saint-Germain 5 Amiens 0: Ten wins in a row for PSG as Neymar rests|
|Cristiano Ronaldo nets record 400th league goal|
|Marcelo backing beleaguered Lopetegui despite Madrid slump|
|Garcia dazzles to hit the front at shortened Valderrama Masters|
|Cardiff City 4 Fulham 2: Paterson gets Bluebirds off the mark|
|Newcastle United 0 Brighton and Hove Albion 1: Benitez´s men bottom after dismal defeat|
|West Ham 0 Tottenham 1: In-form Lamela settles London derby|
|Manchester City 5 Burnley 0: De Bruyne returns in comfortable win|
|Wolves 0 Watford 2: Capoue and Pereyra turn form book on its head|
|Bournemouth 0 Southampton 0: Howe´s side stifled by Saints|
|Prove you´re crazy about Inter - Spalletti rallies players ahead of Milan derby|
|Wolfsburg 1 Bayern Munich 3: Lewandowski leads Kovac out of trouble|
|Goerges betters Bencic to clinch Luxembourg title|
|Morgan wants more from ´rusty´ England despite series win|
|Sarri says sorry after touchline bust-up overshadows Chelsea´s late escape|
|Chelsea draw an ´awful´ result for excellent United, says Mourinho|
|The Chelsea assistant that angered Mourinho - Who is Marco Ianni?|
|Steve Kerr supports Colin Kaepernick: ´I think he deserves a chance to play´|
|Lopetegui ´more motivated than ever´ amid Real Madrid sack reports|
|That´s football – Rudiger shrugs off late Ianni-Mourinho fracas|
|AC Milan´s improved mentality could be difference against Inter - Gattuso|
|Emotional Kasatkina comes back from the brink to win Kremlin Cup|
|Forget it, it´s over - Mourinho accepts apology over touchline row|
|Mourinho in furious bust-up with Chelsea staff after late equaliser|
|Chelsea 2 Manchester United 2: Barkley strike denies Mourinho|
|Raptors star Kawhi Leonard: Too early for MVP chants|
|WTA Finals 2018: Profiling the ´elite eight´|
|Cipriani sent off and facing ban for high tackle|
|Real Madrid 1 Levante 2: Lopetegui on the brink as abysmal run continues|
|Warriors coach Kerr: Jerebko ´one of us´ after game-winning tip-in|
|Real Madrid break record for longest goalless run|
|England wrap up ODI series in Kandy rain|
|Melbourne Victory 1 Melbourne City 2: Honda scores but suffers losing start|
|Mata starts for United as Chelsea boss Sarri selects Morata|
|Dovizioso prepared for another Marquez duel|
|Isco returns as Bale makes the bench for Real Madrid|
|Maddison feeling at home with Puel´s Foxes|
|Ruthless Australia beat Tonga in historic Test|
|Pep talks helped Mendy make the most of his time out of action|
|Wantaway Butler revels in boos|
|Emery: Arsenal must be calm with returning Koscielny|
|Sevilla don´t fear Messi or Barca – Kjaer|
|Conte, Zidane and the AC Milan contenders clouding Gattuso´s future|
|Koepka in control in South Korea, on track to become world number one|
|Dovizioso grabs pole at Motegi, Marquez sixth|
|Langer backs Marsh for ODI squad|