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.
|Guardiola praises new Arsenal boss Emery|
|Defensive woes, travel sickness and Ozil´s role - Emery´s Arsenal to-do list|
|WATCH: Anthony Joshua serves up Stephen Curry assist|
|De Villiers announces international retirement|
|Salah not comparable to Ronaldo yet - Karius|
|Toure open to Manchester United switch & wants to play with Pogba|
|Rockets backed up fighting talk, says Harden|
|Europa League master, record return at PSG - Arsenal boss Emery in Opta numbers|
|Curry not taking the blame for defeated Warriors|
|Arsenal confirm Emery appointment|
|Bellamy confirms talks with Brisbane Broncos|
|Ref took Champions League final away from Roma - Under|
|Goals galore and sinking City - Liverpool´s road to the Champions League final|
|Benitez: Winning Champions League changed my life|
|Brewers extend Diamondbacks´ losing streak to six|
|Weidenfeller bids farewell in Schmelzer´s last game as Dortmund captain|
|Owen surprised by Zidane success|
|Rockets break Warriors´ 16-game home postseason win streak|
|Bennett keen to see out contract as Broncos target Bellamy|
|Copa Libertadores Review: Silva helps Cruzeiro into last 16|
|Chargers tight end Henry suffers torn ACL|
|WATCH: Harden dunks all over Green|
|Madrid are linked to 50 players – Ronaldo laughs off Neymar rumours|
|Giants sign wide receiver Shepard|
|Salah wouldn´t improve Real Madrid – Del Bosque|
|Stevens says Tatum should´ve been unanimous All-Rookie First Team selection|
|Rodgers on Bryant: If he ends up here, we´ll welcome him|
|Jets´ Hackenberg dealt to Raiders for 2019 conditional pick|
|Mets sign Bautista, start him same day|
|Warriors´ Iguodala ruled out for game four|
|Guzman called up as Romero replacement for Argentina|
|Gaya signs new five-year Valencia contract|
|Celta appoint Antonio Mohamed as new coach|
|Klopp: Real Madrid have no weaknesses|
|Strauss ´stepping away´ from England role to support wife|
|Argentina rule Romero out of World Cup|
|Emery´s website appears to confirm Arsenal appointment|
|´Inspiring´ Guardiola has made Fleetwood a better golfer|
|Two trophies in a week! Torres leaves Atletico Madrid in style|
|I died a thousand deaths - Yates set for Giro defensive after time trial|
|Hamsik hints at Napoli exit amid China rumours|
|Rowett swaps Derby for Stoke|
|Thiem comfortable in victory as rain delays Wawrinka|
|Schmelzer gives up Borussia Dortmund captaincy|
|Top seed Stephens struggling at Nuremberg Cup|
|This is the wrong information - Vieira rejects Nice speculation|
|France rest Guirado, recall Thomas for New Zealand tour|
|Warriors´ Iguodala upgraded to questionable for game four|
|Simmons, Mitchell unanimous picks for NBA All-Rookie first team|
|AC Milan referred over alleged FFP breaches|
|F1 Raceweek: Ferrari and Red Bull target Monaco upturn|
|Horoya 2 Mamelodi Sundowns 2: Camara header denies visitors´ comeback|
|Du Plessis rescue mission takes Super Kings to IPL final|
|Seedorf to leave relegated Deportivo|
|Wenger turned down Real Madrid ´two or three times´|
|Kane dreams of lifting World Cup trophy as England captain|
|UEFA opens disciplinary proceedings against Liverpool & Roma|
|Yates stays on course for Giro title, Dennis wins time trial|
|Brighton sign Nigeria international Balogun|
|Ronaldo again pips LeBron and Messi as sport´s most famous star|
|Marcelo fears backlash if Madrid lose Champions League final|
|Messi joins Argentina´s World Cup training camp|
|FIFA finds no doping cases in Russia´s World Cup squad|
|Liverpool´s strikeforce reminds Ronaldo of Real Madrid|
|Hysaj staying at Napoli ´regardless of Sarri´s future´|
|Amir fully fit for Lord´s Test|
|A fast start to life - The Golden Knights and the expansion teams who excelled early|
|Molina gets two-year anti-doping ban for positive test after Joshua bout|
|Ramos: We´re a vintage Real Madrid team|
|Klopp key to controlling Liverpool emotions, says Alonso|