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.
|NBA 2018-19: It´s a big season for - Ball, Kawhi, Carmelo, Love & Cousins|
|Bellew: I have no fear of Usyk|
|Birthday boy Ozil is the most creative player in Europe|
|CSA reveals De Villiers and Rabada involved in Mzansi Super League|
|FA condemns England supporters involved in trouble in Seville|
|Gascoigne hits back over Scottish Hall of Fame snub|
|NBA 2018-19: LeBron closing in on Jordan, Curry chasing Miller and Allen|
|Ter Stegen should start ahead of Neuer for Germany – Matthaus|
|England´s Sterling impressed by Sancho´s work ethic|
|Vandoorne seals switch to Formula E|
|Halep to end 2018 as world number one|
|Sri Lanka´s Jayasuriya charged by ICC with breaching anti-corruption code|
|Vermaelen out for six weeks with hamstring injury|
|LeBron and Irving did not fall out, says ex-Cavs trainer|
|Ramsey out of Wales´ clash with Republic of Ireland|
|Bolt angry with drugs test|
|Bad luck is not a coincidence – Kimmich concerned by Germany form|
|Mahomes: Chiefs need to win like Brady and the Patriots|
|Schuster warns Real Madrid not to panic-buy striker in January|
|We´re here to win! - Paine not happy celebrating a draw|
|Injured Thauvin out of Germany clash|
|Southgate hits out at early Premier League start|
|Modric to Inter talk is ´fantasy´, says Guardiola|
|Pats hand first loss to Chiefs after wild shoot-out|
|Cowboys, Ravens dominate as Pats beat Chiefs in NFL classic|
|Brady becomes first QB to 200 regular-season wins in NFL|
|Red Sox level series against Astros|
|Mbappe leaves red-faced Dembele on his backside|
|Red Sox ace Sale admitted to hospital with stomach illness|
|From UFC to NFL? McGregor throws pass for Cowboys|
|Ancelotti praises ´dangerous´ Mbappe|
|Uncapped Papalii named in All Blacks squad|
|Kane would star in LaLiga – Ramos|
|Guardiola unsure about Man City´s Champions League chances|
|Dzeko: Premier League return? You never know|
|Gurley dominates to help Rams beat Broncos|
|Butler expected to play Timberwolves´ opener against Spurs|
|I´m no wizard – Mancini asks for patience with Italy|
|The Messi and Ronaldo era is phenomenal – Guardiola|
|Dolphins defeat Bears in OT with 47-yard field goal|
|Almirola picks up win at Talladega|
|Wigan´s Sarginson wanted Grand Final glory in memory of brother|
|McLeish: Scotland keep shooting themselves in the foot|
|Sarries´ walking wounded a concern for Jones|
|Poland 0 Italy 1: Biraghi seals last-gasp win to keep final-four hopes alive|
|Seahawks top Raiders with blowout win in London|
|In-demand Hogg hints at Glasgow exit|
|Holder calls on Windies batsmen to step up after India whitewash|
|France´s World Cup win hurt me - Koscielny retires from international football|
|Bailey performs U-turn on Jamaica call-up|
|Evans becomes Buccaneers´ all-time leading receiver|
|Overlooked Alba is one of the world´s best, says Ramos|
|Del Potro a major ATP Finals doubt due to fractured patella|
|Gomez to replace suspended Stones for England|
|Luis Enrique applauds ´adaptive´ Southgate|
|Pepperell holds off Bjork for wire-to-wire British Masters glory|
|Steelers´ Shazier returns to Bengals´ stadium for first time since injury|
|Scotland 1 Portugal 3: Santos´ side pile misery on McLeish|
|Falcons prey on Toulon, Vunipola brothers injured in Sarries win|
|N´Golo Kante is fundamental for France – Lucas Hernandez|
|Real Madrid star Bale withdraws from Wales squad|
|50 Cent to meet Khabib for Bellator talks|
|Drink-driving charge does not change who I am – Lloris|
|Pavard backs Varane to beat favourites to Ballon d´Or|
|Gareth gives players more input - Henderson explains Southgate, Klopp contrast|
|Stephens qualifies for WTA Finals as Svitolina sits out Kremlin Cup|
|Disrespectful critics are treating us like amateurs - Hummels|
|Final Proteas-Zimbabwe T20 washed out|
|Deontay Wilder apologises for punching mascot on live TV|
|Irrepressible Djokovic hunting year-end number one|