Forced to follow-on after being bowled out by Pakistan for 130 in their first innings - a first innings deficit of 180 - openers Ed Joyce and William Porterfield went on to make amends second time around, recording Ireland's first half-century partnership after each was dropped early in their second innings.
Mohammad Abbas did the initial damage with the ball as Ireland collapsed to five for three before lunch, with the paceman finishing with figures of four wickets for 44 in 11 overs, while leg-spinner Shadab Khan took three for 31 in 13.2 overs.
Murtagh hurled in the opening ball to Pakistan batsman Azhar Ali, who got the briefest of touches, before making a run for the opposite stumps.
The 22-year-old was left flat on the ground and needed several minutes' treatment on the field, but he recovered to face the second ball of the match, with Imam playing and missing.
Warriors coach Steve Kerr on how Rockets have improved defensively
Instead it was the wily veteran, who gave us glimpses of the Paul we fell in love with early in his career in New Orleans. He definitely has time to turn it all around, though, and the Rockets will need him if they want to beat the Warriors .
Imam is the nephew of Pakistan selection chief and former Test batsman Inzamam-ul-Haq and his inclusion in the squad provoked allegations of nepotism.
This was the first time Pakistan had enforced the follow-on in a Test in 16 years since they beat New Zealand by an innings and 324 runs at Lahore in 2002.
Barely had the crowd's cheers subsided when Pakistan were 13-2 off the very next ball.
Pakistan rebuilt and managed to not lose a wicket before the lunch break.
"The noise for those first couple of wickets was great, they really got behind us and that helped with the adrenaline pumping and gave us an extra spring in our steps as bowlers", said Murtagh.
Carlos Carvalhal to leave Swansea City at end of season
Swansea, who are third from bottom in the table, are nearly certain to be relegated on Sunday . If we beat Southampton on Tuesday evening, only a draw would be required at home to Stoke.
Babar Azam (14), pushing hard at a Murtagh delivery that left him off the pitch, was well-held by Paul Stirling at second slip.
Shafiq was the next to go, for a well-made 62, and it was Rankin that got him with a short ball.
But with the towering Rankin, bowling from around the wicket, a similar shot proved Shafiq's undoing when he found Andrew Balbirnie at square leg.
Joyce was on nought when he edged Amir to wicket-keeper Sarfraz Ahmed, with the diving Pakistan captain unable to cling on to the low chance.
But Shadab and Faheem turned the tide in impressive style for two Test novices. Gary Wilson finished unbeaten on 33 runs. He deserved better than for his first innings to be truncated after four balls by an lbw decision when the ball pitched outside legstump.
Carlos Carvalhal to leave Swansea City at the end of the season
Southampton now have 36 points - three more than Swansea, who entertain relegated Stoke on Sunday. Because Swansea will nearly definitely be playing their football in a lower league next season.
- USA to impose new sanctions on Iran
- Rooney Agrees Deal To Join MLS Club DC United
- China Barred From Airing Eurovision Finale After Censoring LGBT Content
- 'Everyone Thinks' I Deserve Nobel Peace Prize
- Lalu Prasad granted six weeks provisional bail
- TALAT: Surf lights up blue in San Diego
- Theresa May told ministers to get 'hands on' over customs dispute
- Adnoc to invest Dh165bn with partners in downstream
- Pujdeme refused to run for the presidency of Catalonia
- The Royal Wedding Is Now Finally, Officially Approved by the Queen