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.
18. Juli 2018
|Sarri wants new central midfielder and hints at Chelsea stay for Cahill|
|Nantes sign former Manchester United full-back Fabio|
|Marcelino rewarded with one-year Valencia extension|
|Warburton retires: Bale leads social media tributes to Welsh great|
|Mistakes do not define me, says Chelsea boss Sarri|
|Saints and Tigers to honour Horne with Twickenham clash|
|I want to keep Hazard, says Sarri|
|Europe must stop American juggernaut at Carnoustie|
|Joshua planning for heavyweight ´legacy´ – starting with Povetkin|
|Warburton retires: Wales and Lions star´s career in numbers|
|Matching ´ridiculous´ Tiger not on McIlroy´s radar|
|Spain sent me World Cup SOS, claims Benitez|
|Ozil, Gundogan critics should ´shut up´ - Klopp|
|McIlroy plans to play carefree at Carnoustie|
|Pakistan thrash Zimbabwe to secure series win|
|Warburton retires: Gatland salutes Wales and Lions great|
|Sturridge determined to stay at Liverpool|
|Mbappe is an alien – Varane|
|Warburton retires from rugby|
|India to assess Bhuvneshwar as Bumrah makes Test squad|
|Injured Craddock passes $100,000 in donations at Tour de France|
|WATCH: Perez taunts team-mate after audacious training goal|
|Alison Becker tweets ´I´m joining Liverpool´... but all is not as it seems|
|F1 Raceweek: Hamilton chasing down Schumacher - German GP in numbers|
|Notorious Carnoustie holds fond memories for legendary Watson|
|Rooney refused to be ´dead weight´ at Everton|
|The Open 2018: Molinari, Rahm and the in-form contenders at Carnoustie|
|Marsh interested in Australia leadership roles|
|United can challenge City for Premier League title, says Rooney|
|MLB All-Star 2018: Seven things you missed at Midsummer Classic|
|American League win home run-filled MLB All-Star game|
|Dragons lure Sims from Broncos|
|Cassano: Ronaldo like Nadal, Messi like Federer|
|Lakers´ Ball undergoes successful knee surgery|
|´We kill them, Messi or no Messi´ - Pogba´s pre-Argentina World Cup speech revealed|
|Cardinals suspend GM Keim for five weeks after DUI|
|Dalic: I can coach Brazil or Barca but Croatia my favourite|
|Warriors coach Kerr extends contract|
|I´m ready to bust him up - Miller calls out Joshua after New York confrontation|
|CAF Champions League Review: ES Tunis and TP Mazembe set the pace|
|Mixed day for seeds in Newport as Muller progresses|
|Rams sign Cooks to five-year extension|
|Cowboys’ Randy Gregory reinstated by NFL|
|Verdasco survives Swedish Open scare as Paire is picked off in Umag|
17. Juli 2018
|US Open announces record prize fund for 2018|
|Stosur wins battle of former grand slam champions in Gstaad|
|Emery is Arsenal´s best signing, says Pires|
|Brewster commits to Liverpool with long-term deal|
|Panama boss Gomez steps down after World Cup|
|No Chelsea agreement for Golovin, claims CSKA president|
|Root looks right at home as England ease to series victory|
|Brighton sign Mali midfielder Bissouma from Lille|
|Kaka backs Brazil boss Tite after ´excellent´ World Cup|
|Alaphilippe the toast in France as Van Avermaet increases Tour lead|
|Shkupi 0 Rangers 0: Gerrard´s men advance despite dour draw|
|Khazri ends Sunderland nightmare as Saint Etienne swoop|
|The Open 2018 diary: Rose lets Rio go as Rahm goes ´Lefty´|
|Lampard raids Chelsea and Liverpool in Derby double swoop|
|Balotelli returns to Nice training after Marseille talks stall|
|Owens wants to play in the CFL, says agent|
|I don´t like thinking too much - Johnson|
|Toulon president fined as French club receive suspended points penalty|
|Top of the flops - Mickelson plays exquisite trick shot over man´s head!|
|Kerber targeted Wimbledon after 2017 disappointment|
|England´s World Cup heroes given dedicated parking spots|
|Insigne prefers Messi to new Juve star Ronaldo|
|Koepka enjoys playing with a chip on the shoulder|
|Ryan Hall to leave Leeds Rhinos amid reports of NRL move|
|Hamann slams Lahm for Low criticism|
|Hart named in Manchester City squad for United States tour|