Mohammad Abbas struck either side of lunch to leave Ireland in dire straits at 92 for eight come tea on the third day of their inaugural Test against Pakistan at Malahide on Sunday.
Ireland now needed a further 66 runs, with just two wickets standing, to avoid the possibility of the follow-on after Pakistan had made 310 for nine declared in their first innings.
At seven for four, Ireland were in danger of marking their debut with the lowest completed innings total by any side in the 141-year history of men's Test cricket -- New Zealand's 26 against England at Auckland in 1955.
But Kevin O'Brien's belligerent 40 at least spared them that embarrassment.
Meanwhile Gary Wilson, who injured his arm batting in the nets and so came in down the order, ensured South Africa's 84 against England at Port Elizabeth in 1889 remained the lowest total by a side in their maiden Test innings when he edged leg-spinner Shadab Khan through the slips for four.
At tea, paceman Abbas had taken three wickets for 25 runs in six overs, with left-arm quick Mohammad Amir weighing in with two for nine in 10 and Shadab striking twice in three balls to continue his fine all-round display after an innings of 55 in just his second Test.
Wilson was 14 not out at tea, with Boyd Rankin -- who had previously played one Test for England -- unbeaten on six.
The batting of Ireland, the 11th nation to play men's Test cricket, was always likely to prove decisive in the outcome of this one-off match.
Pakistan captain Sarfraz Ahmed's well-timed declaration left Ireland with a tricky 30 minutes to bat before lunch and that was long enough to leave the hosts five for three come the interval.
Veteran opener Ed Joyce was first to go, lbw to Abbas for four.
Former England one-day international Joyce, arguably Ireland's greatest batsman and at 39 the oldest debutant at this level since Australia's Bryce McGain made his Test bow aged 36 in 2009, appeared to be a victim of the fact the Decision Review System was not being used because Cricket Ireland had decided they could not afford the $50,000 cost.
But while replays suggested the ball that did for left-hander Joyce may have pitched outside the line, there was little doubt about the Abbas delivery that had fellow opener Andrew Balbirnie lbw for a duck.
It was a miserable end to an eight-ball innings where Balbirnie was almost run out by Asad Shafiq's direct hit from short leg.
Ireland captain William Porterfield then fell for one when Amir uprooted his off-stump with what became the last ball before lunch.
Soon afterwards wicket-keeper Niall O'Brien was lbw to Abbas for nought.
Paul Stirling (17) offered some resistance before he carelessly holed out off Faheem Ashraf to give the debutant a maiden Test wicket after the all-rounder had top-scored for Pakistan with 83.
Shadab then clean bowlied Stuart Thompson and two balls later he had Tyrone Kane caught in the slips for the third duck of the innings.
Kevin O'Brien, Niall's brother, struck five fours before driving Amir to cover.
Pakistan resumed on their overnight 268 for six, with Shadab and Faheem extending their seventh-wicket century stand to 117 before Shadab was lbw to Tim Murtagh, striking with the new ball on his way to four for 55.
Faheem, dropped on 36 on Saturday, was missed in the slips on 62 and 72.
But in sight of a hundred on Test debut, a notable achievement, Faheem was caught behind off medium-pacer Thompson.