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.
|Pulisic signing would interest Klopp|
|Whatever b******t you say, no one forgets – Klopp defends spending comments|
|Usyk outclasses Gassiev to make cruiserweight history|
|Pella books Cecchinato meeting in Umag, Ramanathan´s Newport run continues|
|Kisner expects nothing but exchange of ´horror stories´ with housemate Spieth|
|Inter new boy Lautaro Martinez denies Zenit in six-goal thriller|
|McIlroy eyeing early gains to apply scoreboard pressure|
|The Open 2018 diary: Spieth´s close shave|
|Salah is fully recovered and full of joy – Klopp|
|De Laurentiis accuses Sarri of trying to sign whole Napoli team|
|Lewis Hamilton explains German GP woes|
|O´Driscoll hails ´Test match animal´ Warburton|
|Spieth relishing prospect of Tiger tussle at Carnoustie|
|Sanches pushing for Bayern second chance - Kovac|
|Put on the Sunday red and enjoy Tiger´s ride regardless of Carnoustie outcome|
|Flawless Spieth takes share of Open lead after Tiger winds back the years|
|PSG´s Tuchel to be patient with World Cup stars Neymar, Mbappe & Cavani|
|Sanchez joins United tour in LA after visa issues|
|Catalans crush Salford to confirm Super League safety|
|Hamilton not giving up despite Hockenheim heartbreak|
|Spieth surges into Open Championship lead|
|Dumoulin is our biggest threat – Froome|
|Sane: Low gave me good reasons for World Cup snub|
|Tiger Woods in the hunt and loving it at The Open|
|Vettel delighted with German GP pole performance|
|Deschamps lauds intelligence of ´extraordinary´ Mbappe|
|Thomas maintains advantage as Fraile powers to stage victory|
|Woods sets clubhouse target, Kisner edges back in front|
|Bayern Munich 3 Paris Saint-Germain 1: Sanches strikes in ICC clash|
|Dost re-signs with Sporting CP after initially rescinding contract|
|Impressive Lions see off Jaguares to seal Waratahs semi|
|I´ll show Mourinho I´m ready, says United´s Pereira|
|Fognini sets up final clash with Gasquet|
|Injury ends Bouchard´s Swiss hopes, Sevastova through in Bucharest|
|That didn´t Work-u...race leader pulls up short of 3000metre finish|
|Prowling Tiger Woods on Open charge as Spieth joins leaders|
|Federer will struggle away from Wimbledon - Henman|
|Hamilton expecting tough Sunday at Hockenheim|
|Spalletti expects Icardi, Perisic to stay at Inter|
|Vettel smashes lap record to take Hockenheim pole after Hamilton woe|
|Warner targets Australia recall after Darwin debut|
|Rose: Open Sunday will be ´interesting´ after 64|
|Hamilton out of German GP qualifying as Mercedes falters|
|Pogba, Mbappe, Griezmann? Deschamps mulls Ballon d´Or contenders|
|Farah concussed on 250th Wests game as Tigers stun Souths|
|Waratahs overrun Highlanders in stunning second-half fightback|
|Rose scores record-equalling 64 to jump into Open contention|
|Moreno hails Liverpool´s recruitment drive as ´top, top players´ arrive|
|AC Milan elect new board with CEO Fassone out|
|Sri Lanka grind sorry South Africa into the Colombo dirt|
|Mina ready to reject offers for Barcelona stay|
|Guardiola tells Sane to use World Cup snub as motivation|
|Golovin´s ex-team-mate Chepchugov drops hint over Chelsea move|
|Reed & Rose make early charges on Carnoustie ´moving day´|
|Sancho ´had a point to prove´ in Dortmund´s win over Manchester City|
|Li hits back at AC Milan owners Elliott as bitter split continues|
|Crusaders cruise past Sharks to book Hurricanes semi-final|
|Rabiot would be a great signing for Barcelona – Xavi|
|JaVale McGee: Lakers are going to be ´one of the most fun teams ever´|
|Dolphins owner Ross: National anthem policy a ´placeholder´|
|Boga leaves Chelsea for Sassuolo|
|Schurrle in talks to leave Borussia Dortmund|
|Guardiola happy with Mahrez and Man City despite loss|
|Dodgers top Brewers in Machado´s debut|
|Raptors GM apologises to DeRozan after Spurs trade|
|Manchester City 0 Borussia Dortmund 1: Gotze spoils Mahrez´s debut in ICC opener|
|United fans keeping De Gea at Old Trafford – Herrera|
|Keita: I turned down Barca and Bayern for Liverpool|
|Merritt stays ahead as rain halts Barbasol Championship|
|Roma had to sell Alisson to Liverpool, says Totti|