Ireland's hopes of pulling off a sensational victory in their maiden Test were enhanced on day five in Malahide as Pakistan dramatically collapsed to 14-3 having been set 160 to win.
Having begun Tuesday on 319-7 in their second innings, leading by 139 after being made to follow on, Ireland could only add 20 to their overnight total.
Centurion Kevin O'Brien (118) fell to the first ball he faced on the final morning and Mohammad Abbas finished with 5-66 to limit the hosts to 339 all out.
However, facing a seemingly modest target, Pakistan made a wretched start with the bat.
Tim Murtagh had Azhar Ali caught at first slip for two before Boyd Rankin struck, Haris Sohail (7) falling to an excellent Ed Joyce catch in the gully.
There was no let up from Ireland and Murtagh claimed his sixth wicket of the match by bowling Asad Shafiq (1), leaving Pakistan three down inside five overs.
Imam-ul-Haq and Babar Azam were tasked with rebuilding the Pakistan innings and ensuring their side avoided an ignominious defeat.