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.
|Liverpool´s strikeforce reminds Ronaldo of Real Madrid|
|Hysaj staying at Napoli ´regardless of Sarri´s future´|
|Amir fully fit for Lord´s Test|
|A fast start to life - The Golden Knights and the expansion teams who excelled early|
|Molina gets two-year anti-doping ban for positive test after Joshua bout|
|Ramos: We´re a vintage Real Madrid team|
|Klopp key to controlling Liverpool emotions, says Alonso|
|Bjorn names Westwood, Harrington, Donald and McDowell as Europe vice-captains|
|Scarlets players left wounded by ´shocking´ Scotstoun pitch|
|Arsenal fined £20,000 for Leicester penalty protest|
|Storm offer Bellamy ´significant´ deal amid reported Broncos interest|
|Rashford writes moving tribute on anniversary of Manchester Arena attack|
|Heaton backs Kane´s captaincy credentials|
|Salah deserves Ballon d´Or if Liverpool win Champions League – Owen|
|Wasps flanker Willis out for up to a year|
|Real Madrid v Liverpool: Is the Champions League enough to save Zidane?|
|I was left out on reputation - Nainggolan angered by World Cup snub|
|Pellegrini targets Europe with West Ham|
|Lopetegui extends Spain contract|
|Edinburgh-bound Barclay´s Scarlets career over following Achilles surgery|
|Saints swoop for NRL star Naiqama|
|Zidane: Be careful when you criticise Ronaldo|
|It doesn´t get better - Stevens relishing best-of-three shootout for Celtics|
|Favre named new Dortmund boss|
|LeBron and Lue hail evergreen Kyle Korver|
|Kane named England captain for World Cup|
|Wright slams Arsenal over Emery: It´s like a sushi shop!|
|Pellegrini named new West Ham manager|
|Late drama and sustained Ronaldo magic - Real Madrid´s road to the Champions League final|
|Yankees´ home runs fuel win over Rangers|
|LeBron scores 44 points as Cavs level series against Celtics|
|Kaufusi re-signs with Melbourne Storm|
|LeBron James sets record for postseason field goals|
|Monchi: Alisson will only leave Roma if I come out of retirement!|
|No offers from Chelsea or Zenit, says Sarri´s agent|
|No Champions League pressure as PSG´s Tuchel calls for patience|
|Nationals´ Juan Soto hits homer in second career at-bat|
|Buffon to decide future in a week amid PSG speculation|
|Eli Apple embarrassed by 2017 antics, ready to move forward|
|Bills release Richie Incognito from reserve/retired list|
|Gentry and Pelicans want Cousins back in New Orleans|
|MLB extends Blue Jays closer Osuna´s administrative leave|
|Lloris, Jedinak and Kjaer ask FIFA to allow Guerrero to play at World Cup|
|Wolfsburg preserve Bundesliga status after play-off win over Kiel|
|Zidane was my idol and always will be - Wijnaldum|
|Liverpool ready to fly out of the blocks in Kiev - Henderson|
|Montreal Impact 0 LA Galaxy 1: Ibrahimovic sent off for slapping opponent|
|Real Madrid v Liverpool: Salah, Ronaldo lead the line in combined XI|
|Bertens keeps hat-trick hopes alive in Nuremberg|
|Monfils and Mannarino fail to fly the flag in Lyon|
|Morata, Fabregas, Herrera and more in Spain´s World Cup rejects XI|
|Reina to face FIGC hearing|
|Emery set to be appointed by Arsenal - reports|
|LeBron ´appreciative´ of hometown effort to put up statue of him|
|Cazorla leaves Arsenal after injury nightmare|
|Derby´s Rowett seeks permission for Stoke talks|
|Messi physically and mentally ready for the World Cup, Sampaoli proclaims|
|Murray expected to return at Rosmalen Grass Court Championships|
|More to Madrid than just Ronaldo - Robertson|
|Wolff: Red Bull and Ferrari favourites in Monaco|
|Iniesta hailed by Xavi as ´the most talented player in the history of Spain´|
|If you Googled ´European nights´, Liverpool would be top result - Klopp|
|Icardi cut from Argentina World Cup squad|
|Test recall a ´fantastic surprise´ for Buttler|
|Klopp needs Premier League to be a Liverpool great – Johnston|
|Salah is ´definitely´ world´s best - Lovren|
|Rhinos captain Watkins ruled out for eight months|
|No clue - Klopp defiant over Can to Juventus claims|
|Younis tips Babar for Pakistan greatness|
|Germany squad numbers hint at World Cup good news for Neuer|