Steven Lawless’ late double helped Livingston to a 3-1 Scottish Cup victory against League One leaders Raith Rovers.
Behind to John Baird’s first-half strike, the Lions looked to be in big trouble as they struggled to break down their lower-league visitors.
However, they were handed a lifeline when Rovers defender Iain Davidson was guilty of handball in the box with just 13 minutes remaining.
Lawless coolly slotted in the first of his two penalties before Lyndon Dykes hammered Livi into the lead just 60 seconds later.
Chris Erskine was then brought down by Michael Miller in added time to allow Lawless to put the tie to bed for the Lions.
It was Livingston who were first to threaten after just six minutes but Aymen Souda could not find the target when Jon Guthrie nodded down a Steve Lawson corner.
They came even closer to the breakthrough 10 minutes later as they settled early following their winter-break lay-off.
Lawson was again the provider, this time with a cross from the right, but Dykes’ bundled shot came back off the post.
It was Raith who grabbed the lead in the 22nd minute. The Stark’s Park side won a corner on the left when Ross Matthews burst into the box but saw his cutback cleared before it could reach Baird.
Then, when Dylan Tait’s flag-kick was only partially cleared, Baird was on hand to hook in Tony Dingwall’s header back into the danger area.
Livingston bossed possession without creating too much before they cut loose late on to avoid an upset.
First, Lawless converted from the spot after Davidson’s handball before Rovers coughed up possession straight from kick-off and Dykes drilled in from 20 yards out.
Time was now the enemy of Rovers and, when Michael Miller tripped substitute Erskine, Lawless eased Livi into the fifth round from the spot.
Stay updated with the latest news, gossip and football stories by following us @Football_P