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.
|Brazil must make Copa America final – Tite|
|Rockets rout Warriors as Green goes scoreless|
|Seahawks rally past Packers|
|Lakers G Rondo to miss 4-5 weeks|
|Durant is done with questions about Green|
|Smith, Warner set to return to IPL in 2019|
|No rivalry between Mbappe and Griezmann – Deschamps|
|Neymar: Emery will bring success to Arsenal|
|Jedvaj backs Croatia to deliver against England|
|Howell grabs first-round lead at Sea Island|
|Rooney backing Kane to break England record|
|Betts named American League MVP|
|Republic of Ireland must improve, says under-pressure O´Neill|
|Injured Sergio Ramos to leave Spain squad|
|Yelich named National League MVP|
|Low praises ´beautiful goals´ from Sane and Gnabry|
|Belgium boss Martinez pleased with patient Batshuayi|
|Wilson and Sancho pay tribute to England ´legend´ Rooney|
|Rooney gave England squad a lesson in humility - Southgate|
|This Week in U.S. Sports: LeBron passes Chamberlain, Williamson looking like he is next|
|We still have a chance - Luis Enrique not giving up hope after Spain defeat|
|Rockets ´parting ways´ with Anthony|
|Rooney became ´embarrassed´ at Manchester United|
|Federer: ´Easier´ to play when I´m up against it|
|Rooney convinced England are in safe hands with Southgate|
|Black Caps skipper Williamson confident over first Test availability|
|Federer cruises into last four of ATP Finals for 15th time|
|Republic of Ireland 0 Northern Ireland 0: Randolph saves light up bore draw|
|England 3 United States 0: Experimental side impresses on Rooney farewell|
|Croatia 3 Spain 2: Jedvaj keeps World Cup finalists in contention|
|Belgium 2 Iceland 0: Batshuayi rekindles Hazard flame with match-winning brace|
|Germany 3 Russia 0: Sane on target as Low´s men stroll|
|´Fancy taking a look at Brexit?´ - Southampton credit Austin with VAR breakthrough|
|Green: Altercation with Durant will make Warriors stronger|
|Juventus star Dybala dismisses Manchester United links|
|Strinic given all clear to return to AC Milan training|
|Papier wait over as scrum-half starts for Springboks|
|MLB commissioner Manfred gets five-year extension|
|South Africa international Du Preez joins brother at Sale|
|Pogba and Sterling support my football dream, says Bolt|
|Asensio wants to ´feel more important´ at Real Madrid|
|Former Roosters and Cowboys centre Linnett joins Hull KR|
|New team tournament ATP Cup wins Djokovic´s approval|
|Roma and Pallotta donate €150,000 to injured Liverpool fan Sean Cox|
|England captain Root reprimanded on frustrating day in Pallekele|
|Jokanovic proud of establishing Fulham´s ´footballing identity´|
|Huget to make first France appearance in a year|
|Mourinho and squad ´united´ despite ´mixed´ start, says Woodward|
|Petaia and Gordon to make Wallabies debuts in Padova|
|Barcelona star Arthur determined not to let Xavi praise go to his head|
|Youthful Netherlands have forged strong bond - Wijnaldum|
|Premier League confirms £5m package for departing chief Scudamore|
|Thiem blasts past Nishikori to keep semi-final hopes alive|
|He´s always got time for me – Gerrard loved learning from Liverpool boss Klopp|
|Kearney and Ringrose return for All Blacks clash|
|Molinari on course for Race to Dubai title, Smith and Otaegui lead|
|Premier League to implement VAR from 2019-20 season|
|FSF urges Premier League clubs to reject Scudamore ´golden handshake´ request|
|Rhinos pull off Merrin coup|
|Ribery apologises for reporter altercation|
|Ford to captain much-changed England, Cokanasiga starts|
|Crotty replaces injured Williams for Ireland showdown|
|Classy Roshen gives Sri Lanka unlikely lead|
|Injured Lukaku out of Belgium-Iceland Nations League clash|
|Rooney ´passionate´ about future coaching career|
|Mehidy spins Tigers to victory despite second Taylor hundred|
|Rooney deserves special England day - Antonio|
|LeBron thinks back to his roots after latest milestone|
|Messi to return for Argentina next year - General manager Burruchaga|
|Walton salutes LeBron after he surpasses Chamberlain|