Kevin O'Brien became the first Ireland batsman to score a fifty in men's Test cricket as the debutants avoided an innings defeat by Pakistan on Monday.
Ireland, made to follow-on, were 212 for six at tea on the fourth day at Malahide - a lead of 32 runs.
O'Brien was 67 not out, having top-scored with 40 in Ireland's meagre first innings 130 all out, with Stuart Thompson (22 not out) providing good support in an unbroken seventh-wicket stand of 55.
Earlier, Pakistan's Mohammad Amir took his 100th Test wicket and for all O'Brien's defiance the tourists remained well-placed to win this one-off match
Ireland started the day on their highly creditable overnight 64 without loss.
But they lost four wickets in Monday's first session, with left-arm quick Amir -- who had both openers dropped during a brief spell on Sunday before going off with a knee problem -- enjoying a burst of two wickets for no runs in six balls.
It was a heartening sign for Pakistan ahead of their upcoming two-Test series in England that will feature back-to-back fixtures at Lord's (May 24-28) and Headingley (June 1-5).
Amir, however, repeatedly limped around the field on Monday when he was not bowling.
Ireland resumed with veteran opener Ed Joyce, arguably their greatest batsman of all time, 39 not out and captain William Porterfield unbeaten on 23.
At that stage they were still 116 runs behind.
The last thing Ireland needed was to gift Pakistan a wicket via a run out and yet that is exactly how an opening stand eventually worth 69 runs ended when Joyce set off for a needlessly tight single before failing to beat Faheem Ashraf's direct hit from midwicket.
The 39-year-old left-hander was out for 43, including six well-struck fours.
Fear that as soon as Ireland lost one wicket, another might follow quickly were proved correct as 69 for one became 69 for two, with Andrew Balbirnie lbw to Mohammad Abbas for nought for the second time in the match as he completed a pair.
Amir struck with his 29th ball Monday when Niall O'Brien, Kevin's brother, had his stumps uprooted for a wicket greeted with the bowler's familiar arms outstretched celebration.
And 94 for three became 95 for four when Amir had Porterfield (32) edging to wicket-keeper Sarfraz Ahmed, the Pakistan captain.
At lunch, Amir had innings figures of two for 12 in 10.2 overs, with Ireland 123 for four -- still 57 behind.
An innings defeat was still a possibility when Amir, given a jail sentence and banned from cricket for five years as a result of his involvement in a spot-fixing scandal during the 2010 Lord's Test, took his 100th wicket in 31 matches at this level when Gary Wilson was held in the slips by Haris Sohail.
But Thompson's single off all-rounder Faheem meant Pakistan would have to bat again, while Kevin O'Brien was looking increasingly assured.
Best known for hitting the fastest-ever World Cup hundred, off 50 balls, against England at Bangalore in 2011, Kevin O'Brien reversed those figures to complete a Test fifty off 100 balls with a single against Shadab.
Pakistan took the new ball with Ireland 193 for six but Kevin O'Brien's response was to clip Abbas for a legside boundary.