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.
|Predators sign Ryan Ellis to eight-year, $50M contract|
|Curran, Woakes, Rashid - who makes way for Stokes in England´s Test XI?|
|Griezmann well positioned for Ballon d´Or, says Simeone|
|Criscito: I was on Genoa bridge shortly before collapse|
|Alonso to leave F1: How the Spaniard´s numbers stack up to the greats|
|Rookie LB Roquan Smith finally signs Bears contract|
|De Villiers enjoying relief from ´unbearable´ Proteas pressure|
|Fernando Alonso to leave F1|
|Spalletti extends Inter contract|
|Godin, Koke, Griezmann and Juanfran named Atletico Madrid captains|
|Ronaldo out of hospital after illness|
|Fury: Beating Wilder and Joshua ´very easy´|
|Dickinson retires to take up academy coaching role|
|Cricket the ´sole focus´ for Stokes as he returns to England squad|
|Cheryshev moves to Valencia on loan|
|Mandzukic retires from Croatia duty after World Cup|
|Ben Stokes found not guilty of affray|
|Tottenham issue new stadium update and apology to fans|
|Chelsea flop Bakayoko moves to AC Milan on loan|
|Gabi urges Al Sadd team-mate Xavi to play on|
|Ronaldo leads UEFA Goal of the Season nominees|
|Federer: Djokovic could be caught up in US Open pressure|
|Ronaldo to Juventus a huge boost for Serie A – Matthaus|
|Werner would welcome Ozil Germany return|
|´Perfectionist´ Serena admits to ´unrealistic´ expectations in tennis and motherhood|
|Klopp praises Deschamps and his ´boring´ France|
|LaLiga 2018-19: Bale or Griezmann - Who will step into Ronaldo´s breach as Messi´s main rival?|
|Woods winning 15th major would be greatest comeback in sport – Faldo|
|Retiring Storm great Hoffman not giving up on Finals dream|
|Folau won´t change aerial approach in All Blacks showdown|
|Racism behind Sterling criticism, says ex-Arsenal star Wright|
|Eto´o joins Qatar SC following Ligue 1 links|
|UEFA Super Cup 2018-19: Atletico academy eclipsing Madrid, La Masia|
|UEFA Super Cup 2018-19: Should Real Madrid cash in on Modric?|
|Scintillating Serena sends warning, Azarenka survives opener|
|DeGrom strikes out 12, Mets hit 5 homers in win over Yankees|
|Djokovic needs nine MPs as Murray crashes out|
|Murray unsure of US Open readiness after Cincinnati exit|
|Van Dijk: Alisson making difference at Liverpool|
|Johnson saves eight MPs but Djokovic prevails|
|Federer anxious ahead of Cincinnati comeback|
|Tevez relishing Messi reunion|
|Ronaldo arrival has taken Juve forward in Europe – Nedved|
|Serena steamrolls Gavrilova in Cincinnati return|
|Packers QB Rodgers doesn´t regret criticising team-mates|
|Indians OF Martin recovering from life-threatening bacterial infection|
|Shoulder injury sends Royals starter Duffy to DL|
|Yankees place Sabathia on DL with right knee inflammation|
|Aubameyang urges Emery to capitalise on his ´spark´ with Lacazette|
|Anderson can play until he´s 40, says Bayliss|
|Keita living childhood dream after securing Inter switch|
|49ers to sign veteran RB Alfred Morris, Kyle Shanahan says|
|Arnaiz leaves Barcelona for Leganes in €5m deal|
|Tottenham´s move to new stadium delayed|
|Roosters-bound Hall suffers ACL injury|
|Murray suffers Cincinnati defeat to Pouille|
|No Cech mate - Arsenal goalkeeper hits back at Bayer Leverkusen|
|Halep first to seal WTA Finals spot|
|Veteran Carmelo Anthony pens one-year Rockets deal|
|Runners and Ryders: Poulter closes in on Team Europe spot|
|Gameiro presented by Valencia after departing Atletico Madrid|
|World Cup winner Kimpembe extends PSG contract to 2023|
|AC Milan send Locatelli on loan to Sassuolo|
|South Africa´s Etzebeth set for return from injury|
|Rafinha ´very likely´ to stay at Barcelona|
|No dual Ryder Cup role should Woods make USA team, says Furyk|
|Inter complete Keita deal|
|David Silva announces retirement from international football|
|Modric in Real Madrid´s UEFA Super Cup squad amid Inter links|
|Neville hopes Shaw is on to something special after first United goal|