Livingston manager Gary Holt insists he was always confident his side would come good and avoid a William Hill Scottish Cup shock against Raith Rovers.
The Ladbrokes Premiership outfit found themselves a goal behind in the 22nd minute, when striker John Baird hooked in the opener for the League One leaders after Livi had failed to properly clear a corner.
The Lions, who had earlier hit the post with a poked Lyndon Dykes shot, then struggled to break down a well-drilled Raith side and created very little in attack.
However, a controversial Iain Davidson handball gifted Steven Lawless a 77th-minute equaliser from the spot, and the men from West Lothian cut loose to book their place in the fifth round with a Dykes strike just 60 seconds later and a second penalty from Lawless in stoppage time, claiming a 3-1 win.
Holt said: "We were doing a lot of good things in the first half and I thought it would come, but we gave the goal away and we needed to raise the tempo.
"We had 45 minutes to get back in the game, so it's not gung-ho, it's not opening up so Raith can hit us on the counter attack.
"Be patient, if it takes to the 92nd minute it takes to then. You've no divine right to win the game.
"I wasn't panicking. How many goals are scored in the last 10 minutes of a game? The stats are there."