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.
|Nadal: Victory over Ebden a step forward|
|Proteas rest Steyn and De Kock for opening ODIs|
|Nadal and Federer march on as rising stars prosper|
|Barcelona president Bartomeu convinced Valverde will stay|
|Inter forward Keita suffers thigh injury|
|Nadal races into third round with easy Ebden win|
|Kimmich ´perfect´ for Barcelona, says Xavi|
|Richardson and Nabi inspire Renegades´ rout of Sixers|
|This Liverpool isn´t a team of chokers – Mane|
|Central Coast Mariners 2 Melbourne City 1: Late Simon winner ends 10-match losing streak|
|Bryan backs Murray to return after hip resurfacing surgery|
|Scotland coach Townsend turns to trio of uncapped hookers|
|Spurs´ Aurier arrested on suspicion of assault, released without charge|
|That was a fireworks show - Warriors revel in record-breaking first quarter|
|We are in talks with Chelsea – Salihamidzic reiterates interest in Hudson-Odoi|
|´Proud´ Messi recognises impact of team-mates after reaching 400 LaLiga goals|
|Henry v Vieira: The Arsene Wenger proteges to move into coaching|
|Federer enjoys ´cat and mouse´ win over Evans|
|Wozniacki cruises through in Melbourne|
|Federer maintains perfect Australian Open second-round record|
|Warriors set NBA record, Butler´s 76ers rout Timberwolves|
|´I like the fact we beat them´ - 76ers´ Butler revels in win over Timberwolves|
|Murray says he´ll ´probably´ have operation|
|Australian Open tribute for Andy Murray surprises brother Jamie|
|Warriors score NBA record 51 points in first quarter against Nuggets|
|Panthers owner Tepper doesn´t rule out Newton missing 2019 because of shoulder injury|
|De Ligt will be world´s best centre-back – Koeman|
|Ronaldo a ´perfect machine´, says Gattuso|
|Barcelona? I can´t say anything - Stuani|
|Silva upbeat about Man City title chances|
|Celtics youngsters say Irving´s callout ´came from a good place´|
|NFL playoffs: Patrick Mahomes v Tom Brady|
|NFL playoffs: Jared Goff v Drew Brees|
|Sixers sign Brewer to 10-day contract|
|Lozano and Morgan scoop CONCACAF awards|
|Lakers ´optimistic´ about LeBron injury|
|Giants produce mammoth fourth quarter against Nymburk|
|Austin FC to join MLS in 2021|
|Henry, Vieira look forward to reunion when Monaco host Nice|
|Barcelona reject Neymar phone call reports|
|Wentz is the quarterback ´going forward´, says Eagles coach Pederson|
|Gattuso: Higuain has not asked to leave|
|Drew Brees by the Opta numbers: 10 facts for QB´s milestone birthday|
|Harry Kane injury: England captain´s history of ankle woe|
|Harry Kane injury: Opta numbers suggest Spurs struggles|
|Harry Kane injury: Tottenham´s options in striker´s absence|
|Allegri: Supercoppa clash practice for Champions League knockouts|
|First in clean sheets, second to Schmeichel in titles – Cech´s Premier League career in Opta numbers|
|Warrington sign England star Widdop|
|Gatland confident Wales can win Six Nations|
|Fulham sign Netherlands international Babel|
|Harry Kane injury: Games the Tottenham striker will miss|
|Simeone focused on matches, not transfer dealings|
|Iran v Iraq: Pressure off for Queiroz & Katanec|
|Vietnam v Yemen: Kocian keeps the faith|
|Darren Bravo back in West Indies Test side for first time since 2016|
|Kane out until March with ankle injury|
|South Korea v China: Son arrives for Group C dead rubber|
|Kyrgyzstan v Philippines: Eriksson remains hopeful|
|McGrath to miss Six Nations, Sexton nearing fitness|
|Kohli savours Dhoni ´classic´|
|Ford: People obsess over Farrell fly-half battle|
|EFL asks Leeds to explain ´spygate´ scandal|
|No alarms for Djokovic and Zverev, Raonic masters Kyrgios|
|Australia 3 Syria 2: Rogic breaks hearts with stoppage-time winner|
|Palestine 0 Jordan 0: Socceroos winner keeps hopes alive for Lions of Canaan|
|Halep: The results don´t matter any more|
|Hard work for Halep as Serena and Osaka sail through|
|Napoli director to take legal action over ´false´ quotes about Rog move|
|Alexander-Arnold facing absence of up to four weeks|