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.
|Giants WR Beckham Jr. explains why he might cramp up: ´I really don´t like water´|
|Man City pay training-pitch tribute to Joe Hart|
|Neymar to be rested as Tuchel rubbishes Ballon d´Or concerns|
|Sarri ´not interested´ in Christensen father´s quit threat|
|Cardinals fire offensive coordinator McCoy after 1-6 start|
|Neymar return unlikely, but anything can happen – Valverde|
|Bairstow a doubt for fourth ODI|
|Manchester United fined for late arrival and delayed kick-off against Valencia|
|Australia-Pakistan chat not ´especially polite´ - Sarfraz|
|Pogba relishing ´pressure game´ against in-form Hazard|
|Don´t bet on Cardiff survival, warns Warnock|
|Buffon enjoying Tuchel´s methods at PSG|
|RIP to Wimbledon epics! Isner feels like The Undertaker following final-set tie-break rule|
|Sevilla performance sealed Bernat´s Bayern exit - Hoeness|
|Keita set to miss out as Liverpool monitor injured stars|
|He didn´t want to be here – Guardiola doubts Sancho will return to Manchester City|
|Sarri: Manchester United are the best in the Premier League|
|Mourinho salutes ´brave´ Shaw for ´best possible´ response to criticism|
|No Ballon d´Or distractions for Griezmann, insists Simeone|
|Wigan stand by Hardaker as full-back prepares to undergo rehabilitation|
|Barcelona deny Neymar talk|
|Hazard can win the Ballon d´Or as a Chelsea player, insists Sarri|
|De Bruyne in contention to start in Manchester City´s clash with Burnley|
|Neymar needs to mature to reach Messi levels - Xavi|
|We have a hell of a lot to do - Paine slams Australia batting|
|Kerber and Osaka to meet at WTA Finals|
|Lorenzo out of Japanese MotoGP|
|Real Madrid handed Africa trip in Copa del Rey|
|Allegri: Ronaldo has sharpened Juventus focus|
|No Wade in Wasps squad amid NFL reports|
|Rooney: Five of us controlled Man United dressing room|
|Bayern bosses launch scathing attack on ´disrespectful´ media|
|Saints lock in Lawes to new deal|
|Adelaide United 1 Sydney 1: Debutant Le Fondre rescues a point|
|Madrid can´t look back, only forward - Lopetegui confident of revival|
|Wimbledon to introduce final-set tie-breaks|
|Abbas inspires Pakistan to series victory|
|Madrid boss Lopetegui hopeful on Bale availability|
|Mood is positive at Bayern, insists under-pressure Kovac|
|LeBron offers food for thought after losing Lakers debut|
|Bolt future not an immediate concern for Mariners|
|Hazard: I could finish my career at Chelsea|
|Buffon hoping to avoid Champions League final against Juventus|
|Wilshere not ready for West Ham return|
|Chelsea v Manchester United: Hazard better under Sarri than he ever was with Mourinho|
|The big Friday Premier League quiz|
|Khawaja suffers meniscal tear, doubt for India series|
|Babbel: Klopp must win trophies now at Liverpool|
|LeBron makes spectacular start on Lakers debut, but LA fall to Trail Blazers|
|Broncos thrash Cardinals to end losing streak|
|Price leads Red Sox past Astros and into World Series|
|LeBron makes fast start on Lakers debut with two massive dunks|
|Real Salt Lake 4 New England Revolution 1: Hosts boost play-off chances|
|Simmons gets triple-double in win over Bulls|
|´Ambitious´ Maguire wants Champions League football|
|Henry praises ´charismatic leader´ Falcao|
|WATCH: Cardinals WR Fitzgerald tackles former QB Warner on sidelines|
|Spurs right not to make signings – Pochettino|
|Icardi happy at Inter, close to contract renewal|
|This Week in U.S. Sports: Bosa leaves Ohio State while the World Series is almost set|
|Liverpool boost as Salah and Van Dijk join training|
|Cowboys discuss road woes, Prescott says team ´addressed the elephant in the room´|
|Isner scrapes through in Stockholm, Monfils eliminates Tsonga|
|Hinch says Altuve would be out with injury in regular season|
|WATCH: Schwarzenegger tells LeBron to make Lakers great again|
|LeBron tells Lakers coach Walton: I´m always fresh!|
|Mayweather should come back to fight me - Alvarez|
|Goerges battles past Vekic, Kasatkina wins all-Russian tie|
|Ask 32,000 Gibraltarians if the Nations League is meaningless - Styche|
|They´re going to speak about it for years - Azhar reflects on comical run out|