Hearts progress to the next round of the Scottish Communities League Cup after a nervy victory over Livingston.
Just before the break, Danny Grainger's 25-yard shot deflected into the goal of Livi goalkeeper Andrew McNeil.
In the 61st minute, Mark McNulty robbed Marius Zaliukas, turned and drove into the top-right corner to restore parity.
After 70 minutes, Zaliuskas atoned for his earlier mistake and drove low into the net from a corner and headed a further goal four minutes later.
The visitors started the match well and link up play involving Jordan Morton and Keaghan Jacobs almost allowed Marc McNulty a clear view on goal, but the Hearts defence recovered to clear the danger.
Then Livi midfielder Stefan Scougall played a through ball to McNulty, but the striker dragged his left foot shot just wide of the target.
The home side's first opportunity came when Scott Robinson found himself with a clear view on goal 25 yards out but fired high over the crossbar.
Hearts then began to have a sustained spell of pressure and Callum Paterson was within inches of connecting with a Driver free kick at the back post.
Andy McNeil, the Livingston goalkeeper, kept his side in the game with two great saves within the space of a minute from Scott Robinson.
The match flowed from end to end and Jamie MacDonald in the Hearts goal did well to tip a shot from French midfielder Anthony Andreu round the post.
With the clock ticking towards half time, Hearts took the lead.
Grainger latched onto the ball 25 yards out, his shot took a deflection and wrong footed McNeil, who just failed to claw the ball back from going over the line.
Two minutes into the second half, Hearts had a strong claim for a penalty turned down by referee Steven McLean.
Paterson turned the Livingston defence inside out and tumbled to the ground eight yards out when challenged by Barr, but despite appealing, no penalty was awarded.
Just as the home side looked set to increase their advantage, Livingston took advantage of a terrible mistake in their defence to equalise.
Hearts captain Zaliukas was caught on the ball 25 yards from goal and Marc McNulty drove forward and fired high into the roof of the net.
After a forcing a succession of corners, Hearts' pressure eventually paid off and they regained the lead.
Livi's defence failed to clear a Stevenson corner and Zaliukas fired the ball low into the corner of the net.
The Lithuanian notched his second of the night when once again the visiting defence failed to pick up at a corner.
Hearts manager John McGlynn: "We were well on top and Andy McNeil has made some great saves in the first half.
"We deserved to be at least one in front at the break and as long as we didn't make a mistake I couldn't see them coming back - and we made that mistake.
"He has to then show character and get his head up and he has done that and scored two goals up the other end.
"He's the team captain and you look to him for leadership and he came through for us. We didn't have any doubts that he would."
Livingston manager John Hughes: "We gave them a fright but we just could not hang on to it. We are disappointed with the goals; two set-pieces and a deflection.
"We could do with a physical presence up front, and also at the back to help us defend the type of situations we came up against tonight."