Hearts survived a scare to book their place in Monday's League Cup second-round draw with a 4-2 win over Arbroath at Tynecastle on Thursday night.
Former Hibs player David Gold gave the League 2 side the lead five minutes before the break but three goals in the early part of the second half turned the tide.
Jordan McGhee grabbed the equaliser and Osman Sow bagged a double - one a penalty. Martin Grehan pulled one back late on for Todd Lumsden's team but a Craig Wilson own goal in stoppage time sealed the victory for Robbie Neilson's men.