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.
|I do my work on the pitch – Icardi unconcerned by Inter contract discussions|
|Lyon defender Rafael set for three months out|
|Inter captain Icardi is the ´perfect´ striker – Spalletti|
|Fulham have to stick together, says Ranieri|
|Nuno hails ´very special´ Wolves achievement after third straight win|
|Stuttgart captain Gentner´s father dies at Hertha fixture|
|Valverde not desperate for new centre-back amid talk of Christensen loan|
|Toulouse and Saracens stay perfect in Champions Cup|
|Kovac lauds Bayern´s best performance of the season|
|Barcelona can get the best out of Coutinho & Dembele, claims Valverde|
|Borussia Dortmund 2 Werder Bremen 1: Alcacer and Reus guarantee top spot for mid-season break|
|Bristol City 2 Norwich City 2: Canaries knocked off their perch despite late equaliser|
|Atletico´s fighting spirit lauded by Simeone, Godin|
|Hodgson relieved to see Palace end Zaha curse|
|Real Madrid 1 Rayo Vallecano 0: Benzema secures steady response to CSKA loss|
|Fulham 0 West Ham 2: Snodgrass, Antonio punish profligate hosts|
|Warnock brands refereeing situation ´a disgrace´ after Watford defeat|
|Inter 1 Udinese 0: Icardi penalty gets lethargic Nerazzurri back on track|
|Wagner retains belief in survival bid despite Newcastle defeat|
|Griezmann feeling the strain after busy 2018|
|Pochettino ´so pleased´ as tired Tottenham scrap to Burnley win|
|Man Utd hand Smalling new contract|
|ES Tunis 0 Al Ain 3: Convincing victory books River Plate semi|
|Championship Review: Bamford fires Leeds to summit, Middlesbrough defeated by QPR|
|Curry reacts to Kings´ trolling with moon landing video|
|Wentz ruled out of Rams clash|
|Pochettino reaches 100 Premier League wins for Tottenham faster than Wenger for Arsenal|
|Real Valladolid 2 Atletico Madrid 3: Griezmann the hero on landmark appearance|
|Silva rues Richarlison´s missed chances at City|
|Gibson has no worries over Proteas batsmen|
|Wolves 2 Bournemouth 0: Jimenez and Cavaleiro score against toothless Cherries|
|Crystal Palace 1 Leicester City 0: Captain Milivojevic earns vital victory|
|Watford 3 Cardiff City 2: Hornets hang on despite late fightback|
|Tottenham 1 Burnley 0: Eriksen snatches victory at the death|
|Huddersfield Town 0 Newcastle United 1: Rondon strike settles scrap|
|Sabres suspend forward Berglund for failing to report to the team|
|Saunders thanks Fury for getting him ´back on the right track´|
|Hannover 0 Bayern Munich 4: Gnabry and Kimmich star in crushing win|
|I admire Sterling – Guardiola|
|City´s strength in depth makes it hard for me – Jesus|
|Jamieson holds slender lead in Malelane|
|Kashima Antlers 3 Guadalajara 2: Comeback win sets up Real Madrid semi-final|
|Hosszu claims fourth Hangzhou gold, Le Clos beaten by Santos|
|Manchester City 3 Everton 1: Jesus at the double as City go top|
|Parker defiant on low blow claims after ending 2018 ´with a bang´|
|Alisson: Liverpool must beat Manchester United|
|Mourinho´s brutal honesty praised by Karanka|
|Fielding inspired by Bellew after overcoming setbacks to face Canelo|
|Mourinho loves being a manager ´more than ever´|
|Khawaja unconcerned by poor start to India series|
|WATCH: Dellavedova dives into media table to rescue possession|
|Christmas form could transform Man United´s season - Rashford|
|Urgent changes needed at Manchester United – Ferdinand|
|Ishant confident as Kohli carries India into day three|
|Modric takes aim at Simeone for ´constantly undermining Real Madrid´|
|Kevin Durant provides playoffs warning to inconsistent Warriors|
|A-League Review: Janjetovic off as Wanderers suffer derby defeat|
|VanVleet turnover the ´turning point´ in Raptors loss|
|Shanahan on Mahomes no-look pass: ´I do it all the time´|
|De Bruyne and Aguero return to City bench, Sterling left out of starting XI|
|Kohli and Rahane combine to thwart Australia in Perth|
|Modric cool on Madrid future beyond current deal|
|´Fatigued´ Embiid has a lot on his shoulders - Brown|
|Crespo agrees to take charge at Banfield|
|Westbrook on Murray scuffle: He was in my way|
|Liverpool v Manchester United: Van Dijk the rock on which Klopp can build a title triumph|
|Marcelo ´never´ considered Madrid exit amid Juventus links|
|Liverpool v Manchester United: Resurgent Rashford now a leader for Mourinho|
|Injury-plagued Nuggets beat Thunder to hold Western Conference lead|
|Southee takes five as Sri Lanka recover in Wellington|