Kevin O'Brien scored Ireland's first Test century to bolster hopes of at least avoiding defeat in their debut in the five-day game against Pakistan.
Ireland resumed day four on 64-0 in their second innings having been forced to follow-on by the visitors, who reduced the hosts to 157-6 to seemingly put them in position for an emphatic victory.
Mohammad Amir, having been troubled by a knee injury on day three, looked back to fitness and form on Monday and did much of the damage with figures of 3-57.
But Amir and the rest of the Pakistan attack were frustrated by the brilliance of O'Brien, who forged a pivotal partnership of 114 with Stuart Thompson (53) and an unbroken one of 48 with Tyrone Kane (8), staying unbeaten on 118 to guide Ireland to 319-7 at the close on an historic day at Malahide.
Ireland therefore lead by 139 going into the final day, with a draw and even a victory still within their grasp after being applauded off the field by Pakistan at stumps following O'Brien's magnificent effort.
Opener Ed Joyce (43) was run out by Faheem Ashraf before Andy Balbirnie went for a duck five balls later as Ireland made a dreadful start to the day.
The prospect of defeat loomed ever larger after Amir dismissed any doubts over his ability to produce pace by sending Niall O'Brien's (18) off and middle stumps careering out of the ground, before then claiming the scalp of captain William Porterfield (32).
O'Brien's arrival at the crease prompted the first signs of Ireland resistance but wickets continued to tumble around him until Thompson joined him in the middle.
Their defiance ensured Ireland would not only avoid an innings defeat but also give their own attack something to bowl at in Pakistan's second innings.
And, though a ripper from Shadab Khan removed Thompson, O'Brien proved immovable, his belligerent strokes keeping the scoreboard ticking before he wrote his name in the history books by sneaking two through point to bring up his hundred.
O'Brien and Kane withstood pressure from Amir, Rahat Ali and Mohammad Abbas late in the day, and Ireland go into the last three sessions with the unexpected dilemma of deciding how long to bat before attempting to bowl Pakistan out to seal a seismic shock win.
11. Dezember 2018
|Silva lauds Digne after stunning free-kick|
|Aduriz joins Messi, Ramos in LaLiga history books|
|We have a plan - Ravens coach Harbaugh prepared for Flacco return|
|´It´s difficult to accept´ - Gracia calls for introduction of VAR|
|LaLiga press on with overseas match plan despite Barcelona withdrawal|
|PSG open Coupe de France defence at fifth-tier Pontivy|
10. Dezember 2018
|Hazard backs Sterling as Neville reveals England star´s Euro 2016 concerns|
|Everton 2 Watford 2: Digne salvages draw with 96th-minute free-kick|
|Barcelona could ´steal´ Kane, says Pochettino|
|Oakland Raiders fire general manager McKenzie|
|Struggling Villarreal appoint Garcia Plaza as Calleja successor|
|Warriors assign Cousins to G League team|
|Barcelona pull out of plan to play LaLiga game in Miami|
|Pochettino to keep an eye on Inter when Spurs face Barcelona|
|Pochettino confirms Walker-Peters set to start against Barcelona|
|Denver Nuggets add free agent Young|
|Topping Group A no magic wand for an easy knockout draw, says Simeone|
|The cake has been made, now we need the cherry - Ancelotti targets repeat at Anfield|
|Lloris braced to face ´one of the best in history´ in Messi|
|Tuchel expects Neymar to face Red Star|
|Foden signs Manchester City deal to 2024|
|It happened to me! - Valverde laughs off Dembele timekeeping|
|´Projecting´ an Argentina return? Messi met with AFA president and Scaloni|
|Erasmus expects to leave head coach role after World Cup|
|Chelsea issue suspensions pending investigation into Sterling incident|
|Kane is extraordinary – Valverde hails reported Barcelona target|
|Man behind Naomi Osaka´s rise wins WTA Coach of the Year|
|England name unchanged Test squad as Willey returns for West Indies ODIs|
|Spalletti: No issue with Icardi watching Superclasico in Madrid|
|Klopp confirms 2013 talks with ´chatty´ Napoli president De Laurentiis|
|Sri Lanka spinner Dananjaya suspended due to illegal action|
|His reaction was just brilliant – Klopp praises Sterling for response to abuse|
|Gomez renewal a ´smart decision´ for both parties – Klopp|
|Magnificent Molinari named European Golfer of the Year|
|Barcelona best option for Frenkie de Jong, insists midfielder´s father|
|Gronkowski on Miami Miracle: ´Got to make that tackle´|
|Tottenham youngster Walker-Peters signs on until 2023|
|Juventus ´more of a family´ than Real Madrid - Ronaldo|
|Kingsley Coman contemplates retirement if injury nightmare continues|
|McVay ´sick´ over offensive failings as Rams coach takes blame for loss|
|Calleja axed as Villarreal coach|
|Kenyan Drake on Miami Miracle: I couldn´t let Gronk tackle me!|
|Ronaldo: I deserved Ballon d´Or, the numbers don´t lie|
|Rugby Australia to make Cheika decision this month|
|England defender Gomez signs new Liverpool deal|
|Ronaldo wants to see Messi follow him to Italy|
|Neymar happy to play in any position for PSG - Draxler|
|Paine insists he is ´fine´ after taking blow to finger|
|Ponzio: River players will be ´idolised´ for Libertadores success|
|Champions League permutations: How Inter, PSG and Liverpool can progress|
|Kohli: India were better and deserved to win|
|Bears shut down Goff, Rams|
|India survive dramatic finish against Australia|
|Klopp calls for electric Anfield atmosphere against Napoli|
|Saints clinch back-to-back NFC South titles, Bears trump Rams|
|Bucks improve to 2-0 against Raptors with win in Toronto|
|Black Caps include Patel for Sri Lanka Tests|
|Maidana: River want Real Madrid clash|
|Cowboys top Eagles in OT behind stellar Cooper display|
|AC Milan evaluating Fabregas signing – Leonardo|
|WATCH: Steelers´ chance at game-tying field goal slips away|
|Hayne will plead not guilty to charges, says lawyer|
|Boca boss Schelotto: The only thing I feel is sadness|
|Cardinals´ Fitzgerald makes NFL history with most receptions for one team|
|River Plate´s Copa Libertadores star Gonzalo Martinez confirms January departure|
|Klopp: I was never worried about Salah´s form|
|Packers QB Rodgers sets NFL record for most passes without an interception|
|World Cup bulking hampered Man United form – Lukaku|
|Leonardo rules out Ibrahimovic Milan return|
|Warriors´ Green to return against Timberwolves|