Hearts booked their place in the Scottish cup quarter-finals after a Livingston 4-3 penalty shoot-out victory over Livingston at Tynecastle Park.
Craig Gordon was the hero, saving two spot kicks as the Jambos finally saw off their West Lothian opponents.
Hearts made three changes from the midweek defeat to Dundee with Cammy Devlin, Alex Cochrane and Michael Smith returning to the team.
The visitors started brightly and had a chance to open the scoring inside four minutes. Bruce Anderson beat the offside trap and got into the area but Craig Gordon denied him.
Anderson had another chance a few minutes later when he got to the edge of the area but Gordon held his left footed drive. At the other end, Barrie McKay cut in from the left and shot for goal but Max Stryjek made a good save.
He made a better save on 17 minutes when Ellis Simms showed some lovely footwork on the edge of the area to make space but his powerful shot was well diverted wide.
McKay then nearly set up Cochrane after a sweeping move but the defender's low drive was blocked by a superb last gasp challenge.
Into the second half and the match became a slog in appalling weather conditions with no real action to speak of until the final twenty minutes, when the ball spun around the Hearts box, landing at the feet of Alan Forrest whose deflected shot beat Gordon but bounced back off the post.
Then, Simms found some more space in the area, but again was denied by the Livi goalie. With five minutes to go, sub Gary Mackay-Steven whipped in a cross that Simms headed over and from the resulting Stephen Kingsley corner, Stryjek had to tip over a John Souttar header.
The game then entered extra time and a superb run from Souttar into the Livi box found Simms who set up sub Liam Boyce but he blazed his effort over the bar.
In the second period of extra time it was all Hearts but despite a big claim for handball from a Nate Atkinson cross and a Kingsley free kick that flew over the bar, there were no more chances to speak of as we headed for penalty kicks.
Scotland's number one was the hero, saving Livi's final two penalties after goals from Souttar, Peter Haring, Ben Woodburn and Simms put the Jambos into a winning position, as they headed for the quarter finals of the Scottish Cup.
Hearts: Gordon, Smith (Atkinson, 70'), Kingsley, Souttar, Baningime (Haring, 70'), Devlin, Halliday (Boyce, 59'), Cochrane (Mackay-Steven, 59'), McKay (Woodburn, ET 106'), Simms, Sibbick. Subs: Stewart, McEneff, Moore, Ginnelly, Pollock.
Livingston: Stryjek, Devlin, Fitzwater, Obileye, Penrice, Omeonga (Kelly, ET 118'), Holt, Pittman (McMillan, ET 118'), Forrest (Bailey, ET 100'), Nouble (Shinnie, ET 94'), Anderson (Montano, 64'). Subs: Maley, Boyes, Lewis, Longridge, Sibbald, Chukwuemeka, Bailey.
Referee: Nick Walsh