Hearts captain Marius Zaliukas went from villain to hero as the Tynecastle side progressed to the quarter-final of the Scottish Communities League Cup with victory over Livingston.
The Lithuanian defender was responsible for the visitors' equaliser, slipping at the vital moment to allow Marc McNulty to scamper through on goal and make it 1-1 in the second half.
That cancelled out a first-half Danny Grainger goal, but Zaliukas made amends in determined fashion, bundling home two goals in the last 15 minutes to ensure there would be no cup shock in Edinburgh tonight.
Hearts, who ended a three-year winless run at Tannadice on Saturday with a 3-0 triumph at Dundee United, showed just one change, with Andrew Driver replacing promising 17-year-old Dale Carrick.
Livingston had an altogether less enjoyable last encounter, suffering an emphatic 4-0 defeat against Dunfermline at the weekend.
The Lions made two changes, bringing in Paul Watson and former Hearts youngster Jordan Morton for Ross Docherty and Callum Booth.
The visitors made an industrious start and registered the first effort at goal within 10 minutes as Morton, back at Tynecastle with a point to prove, fizzed a decent effort just over the bar from 25 yards.
That proved to be a prelude to an even better chance.
A sumptuous Stefan Scougall through-pass sent McNulty haring through on goal, but his low shot drifted narrowly past Jamie MacDonald's left-hand post.
Speculative pot-shots from distance from Darren Barr and Scott Robinson were all Hearts could muster by way of response during an underwhelming opening from the hosts.
However the hosts did go close on the half-hour mark as a tantalising Danny Grainger free-kick was inches away from finding Callum Paterson at the far post.
Driver was next to threaten as John McGlynn's men ground through the gears, shooting over the bar.
Livingston goalkeeper Andy McNeil then made two marvellous saves from Robinson. He initially parried a point-blank header from the 20-year-old over the bar, then blocked a low shot from the same man following some fine set-up play from Paterson.
Not to be outdone, McNeil's opposite number MacDonald did well to tip a Anthony Andreu effort which skipped along the slick Tynecastle turf and past the post.
On the stroke of half-time the home side claimed the lead in circumstances which were cruel on a Livi side who had held their own against the SPL outfit.
Grainger attempted a shot from 35 yards and, with McNeil behind it all the way, the ball took a vicious deflection off Craig Barr, sending it spinning past the forlorn goalkeeper.
Emboldened by their goal, Hearts emerged with vigour in the second half. Within minutes of the interval the dangerous Robinson glanced a header just wide of the post from a Ryan McGowan cross.
The lead should have been doubled minutes later as Robinson fired in a terrific low cross but, from all of six yards, Arvydas Novikovas smashed his shot over the bar. With the hour mark approaching, Hearts were punished for their missed chances.
Skipper Zaliukas dallied horribly on the ball in his own half, allowing McNulty to rob him.
Showing admirable composure, the 21-year-old lifted the ball past MacDonald.
Zaliukas restored the hosts' lead with 15 minutes to play, scrambling home from close range following a poorly defended corner-kick.
It was 3-1 - and a double for Zaliukas - minutes later, as he rose at the back post to head in a Ryan Stevenson delivery.