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.
|Serena not blaming ankle injury for Australian Open loss|
|Mavericks capitalise on Clippers´ turnovers, pick up win in Smith´s return|
|Pliskova saves four match points to stun Serena with comeback win|
|Anthony ´can only make´ a team better, says Iverson|
|Henry more worried about Monaco´s future than his own|
|Osaka powers past Svitolina in Melbourne|
|Harden on Anthony trade: It kind of sucks that it didn´t work out|
|Redskins remain ´optimistic´ QB Alex Smith will play again|
|Patriots coach Belichick says Rams´ Donald is ´pretty much unblockable´|
|PSG fined €100,000 by LFP over player-recruitment practices|
|I´m not his father - Guardiola demands Mendy matures|
|Sykes record in vain as Banvit claim victory|
|Usain Bolt calls time on football career|
|Otamendi not happy at Man City, says Guardiola|
|Workaholic Woods learning to rest as he prepares for 2019 debut|
|Henry´s Monaco dumped out of Coupe de France|
|Qatar can win Asian Cup, says Sanchez|
|Tim Howard to retire following 2019 MLS season|
|Koscielny backs Bellerin to return from injury ´stronger than before´|
|Chiefs fire DC Bob Sutton after AFC Championship loss to Patriots|
|Reyes returns to Spain with second-tier strugglers Extremadura|
|Emiliano Sala: Profile of Cardiff City striker missing after joining from Nantes|
|Messi rested for Sevilla trip, Boateng set for debut|
|Nuno fined over pitch celebration in Leicester win|
|Nadal unfazed by another Next Gen opponent in Tsitsipas|
|Ulster hand lifetime ban to spectator after Zebo abuse|
|Phehlukwayo´s career-best day inspires Proteas against Pakistan|
|Bournemouth pounce for Brentford´s Mepham|
|You say all signings are controversial – Valverde defends Boateng arrival|
|Search for missing Sala plane suspended|
|Kohli and Williamson display mutual respect as India and Black Caps prepare for battle|
|Qatar 1 Iraq 0: Al Rawi free-kick books quarter-final spot|
|Ba joins Adebayor and Robinho at Istanbul Basaksehir|
|BREAKING NEWS: Tottenham´s Alli out until March with hamstring injury|
|Fit-again Joseph added to England squad|
|It is very, very serious for us - Tuchel wants midfielder in January window|
|Lakers expect Rajon Rondo back Thursday as LeBron James continues rehab|
|Atletico Madrid boosted as Koke thigh injury revealed to be minor|
|South Korea 2 Bahrain 1 (after extra time): Kim Jin-su seals quarter-final spot|
|AC Milan confirm Zapata thigh injury|
|I miss him a lot - Guardiola confirms ´clever´ Mendy back in Man City squad|
|Tiafoe wants LeBron meeting after run to Australian Open quarters|
|Cardiff continue to ´pray´ for Sala|
|West Ham fined over Burnley clash chaos|
|Knicks star Enes Kanter frustrated by reduced role|
|Kvitova getting back to her best, says Barty|
|Kvitova revels in first semi of ´second career´|
|Messi´s the best player in every world – Boateng dismisses past Real Madrid comments|
|Thunder frustrations continue against Renegades|
|Alonso vows to clear name in tax fraud case|
|Classy Nadal downs Tiafoe to set up Tsitsipas semi|
|Hoedt leaves Southampton for Celta Vigo on loan|
|Melbourne City 4 Western Sydney Wanderers 3: Hosts edge thriller with two goals in last six minutes|
|Wilder won´t even pick up the phone - Hearn not hopeful of AJ bout|
|Sala was on board missing plane, say French authorities|
|Arsenal´s Bellerin out for season with ACL rupture|
|Gatland waiting on ´concrete´ offers|
|Ronaldo accepts prison sentence and €18.8m fine for tax fraud|
|Tsitsipas: It was vital to back up Federer win|
|Awesome Kvitova ends Barty´s home run in Melbourne|
|CA rejects Thunder appeal for full points in abandoned Heat clash|
|Emiliano Sala: Concerns grow for Cardiff striker after plane goes missing|
|Harden unimpressed with refs in Rockets´ 76ers disappointment|
|Ronaldo arrives for sentencing in tax fraud case|
|Record-breaking evening ´one of those nights´ for Warriors star Thompson|
|Hazard still interested in Real Madrid but won´t rule out Chelsea stay|
|Collins moves past Pavlyuchenkova, into Australian Open semis|
|Kohli makes history with ICC awards sweep|
|Thompson sets NBA record with 10 straight made three-pointers to open game|
|76ers hand Rockets largest loss of season, Harden scores 37 points|