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.
|Etzebeth returns for Springboks, Pumas include Figallo|
|BREAKING NEWS: Two Serie A matches postponed after Genoa bridge collapse|
|Barrett tight-lipped over Manly future due to ´legal reasons´|
|N´Zonzi is better than Malcom - Monchi takes aim at Barca star|
|Sainz to replace Alonso at McLaren|
|Bayliss encourages Stokes to make public apology|
|Oates hat-trick boosts Broncos´ play-off ambitions|
|Emery needs four transfer windows to impact Arsenal – Wright|
|Spain´s LaLiga plans to play regular-season game in U.S.|
|´Dream come true´ for Robertson to earn Bledisloe Cup start|
|LaLiga match set for USA following groundbreaking Relevent deal|
|FIFA rankings: France number one, Croatia and England soar, Germany and Argentina plummet|
|Hansen hails ´big leader´ Whitelock ahead of 100th cap|
|Cipriani pleads guilty to common assault and resisting arrest|
|PSG snap up Kehrer from Schalke|
|Maitland-Niles facing two months out with broken leg|
|Walker backs City squad strength to overcome De Bruyne blow|
|Thomas & Froome skip Vuelta, named in Tour of Britain squad|
|Thurston rules out retirement U-turn|
|Pumas look to build on Jaguares progress in Rugby Championship|
|Super Cup glory will make Atletico strong - Simeone|
|Rugby Championship 2018: True status of Erasmus´ Springboks rebuild to be discovered|
|LaLiga 2018-19: Coutinho ready to be Barca´s next Brazilian superstar|
|Serie A 2018-19: Can Napoli, Roma, Inter or AC Milan overhaul Juventus?|
|Braves survive skirmish, loss of Acuna to top Marlins|
|Robertson handed surprise start, Hodge gets nod for Bledisloe opener|
|MLS Review: Wayne´s World as Rooney inspires DC United, LAFC win|
|Djokovic and Dimitrov survive but Zverev loses in Cincinnati|
|Rain halts Halep as Muguruza´s defence ends and Wozniacki retires|
|Ozil´s racism claims nonsense, says Kroos|
|Malcom lost for words after Camp Nou bow alongside Messi|
|Injured Fowler withdraws from play-off opening Northern Trust|
|Marcelo happy with Madrid squad amid transfer talk|
|Foles isn´t worried about Brady´s handshake snub|
|Eli Manning on Jalen Ramsey´s comments: ´Who?´|
|Cerezo: Atletico´s objective is to reach Champions League final|
|Judge´s recovery taking longer than expected|
|Ronaldo in the past as Casemiro backs Lopetegui after Madrid loss|
|With our ´cojones´ Atletico can beat anyone – Costa revels in Super Cup glory|
|Super Cup loss doesn´t change Real Madrid transfer policy, says Lopetegui|
|Griezmann: Super Cup triumph justifies staying at Atletico|
|Valverde defends Suarez performances|
|Simeone´s eclipses Aragones as Atletico´s top coach with seventh title|
|Rockets GM: LeBron James is ´the greatest ever´|
|Salihamidzic, Kovac not standing in way of Rudy exit|
|Jaguars DB Ramsey calls Bills QB Allen ´trash´|
|Real Madrid 2 Atletico Madrid 4 (after extra time): Saul stunner seals Super Cup glory|
|Ex-India Test captain Wadekar dies aged 77|
|Gundogan ready to step up in absence of injured De Bruyne|
|Djokovic overcomes illness to see off Mannarino|
|Diego Costa nets fastest UEFA Super Cup goal ever|
|Everton feared missing out on Mina after World Cup strike|
|Barcelona 3 Boca Juniors 0: Messi, Malcom net as Barca win Joan Gamper Trophy|
|All Blacks stick with Barrett as Mo´unga misses out altogether|
|Modric benched for UEFA Super Cup clash with Atletico Madrid|
|Cipriani charged with assault after Jersey nightclub incident|
|Hamburg 1 Bayern Munich 4: Wagner and Muller hit braces in comeback victory|
|WATCH: Messi scores first goal as Barcelona captain|
|Iniesta, Xavi and Puyol were great teachers, says new Barcelona captain Messi|
|Moses retires from international football|
|Goals, assists, set-pieces - The stats that show De Bruyne is almost irreplaceable for City|
|Bergeron wins mammoth 24-man U.S. Amateur play-off|
|Hart to Burnley "not rocket science", says Dyche|
|Leipzig, Schalke reject Rudy transfer rumours|
|Yedlin knee injury not serious, Newcastle confirm|
|Bartomeu satisfied with Barcelona squad amid Pogba links|
|Kevin De Bruyne suffers knee injury|
|Steelers QB Roethlisberger in concussion protocol|
|Kehrer to PSG not complete, say Schalke|
|Hopoate handed 10-year ban from NSWRL|