Ireland are fighting to save the game in their inaugural Test match after being made to follow on against Pakistan at Malahide.
After Pakistan declared on 310-9, Ireland were in huge trouble as they slipped to 7-4 early in the afternoon session, Mohammad Abbas (4-44) and Mohammad Amir (2-9) wreaking havoc with the new ball.
Kevin O'Brien hit 40 and an unbeaten 33 from Gary Wilson, playing with an elbow injury sustained in the warm-up, took them up to 130 before the final wicket fell with Ireland trailing by 180.
Pakistan enforced the follow on for the first time since 2002 in a Test match but Ireland made a better fist of dealing with the new ball second time around and were 64-0 at stumps.
It was a frustrating morning for Ireland as they went in search of the last four Pakistan wickets.
Tim Murtagh removed Shadab Khan (55) with the new ball, courtesy of a dubious lbw decision, but they had to wait another 11 overs for the next wicket.
It was a beauty when it came though, Stuart Thompson getting the ball to jag from outside leg and take Faheem Ashraf's edge (83) on its way through to Niall O'Brien.
Amir then edged Murtagh behind and Pakistan declared soon after, giving themselves half an hour to get stuck into Ireland top order before lunch - and they did just that.
Ed Joyce (4) could join Shadab in wishing DRS was available in this match as he was adjudged lbw to Abbas despite replays showing the ball pitched outside leg but Andy Balbirnie (0) could have no such complaints as he was hit plumb in front, again by Abbas.
Amir then uprooted William Porterfield's (1) off stump with the last ball of the session to leave Ireland stunned at 5-3.
That became 7-4 when Niall O'Brien (0) became Abbas' third lbw victim. O'Brien and Wilson showed some resilience but Shadab (3-31) was a constant threat with his leg-spin and wrapped up the innings with Ireland well short of avoiding the follow on.
It was a different story for Ireland in their second innings but they needed some luck to get through another probing new ball spell for Mohammad Amir, both Joyce (39no) and Porterfield (23no) benefitting from dropped catches.
That Amir was forced to come out of the attack after three overs and was then only able to bowl two deliveries before being withdrawn on his return will concern Pakistan ahead of their two-Test series in England and without the left-arm quick to contend with, Ireland's openers chipped away at the tourists' lead as they batted through to the close.