Brave Arbroath gave Hearts an almighty fright at Tynecastle but saw their hopes of a famous victory dashed by a four- minute blitz by the Jambos.
Todd Lumsden’s men were on course to claim one of the most famous results in their history after David Gold’s first goal for the club gave them a 1-0 lead over the under-par hosts in this League Cup first round tie.
However, Hearts, who were ordered out for the second half by head coach Robbie Neilson several minutes before their opponents, completed a quickfire turnaround.
Jordan McGhee levelled the scores after 57 minutes before Osman Sow bagged a brace to ensure there would be no stunning exit for the Gorgie men.
Martin Grehan climbed from the bench to halve arrears but any Jambo jitters were relieved in stoppage-time when Craig Wilson turned into his own net as he attempted to clear a low cross.
The evening began well for the visitors in the splitting Edinburgh sunshine, with the lively Sergio Cecilia Alvarez stinging the palms of Jack Hamilton with a low drive from distance.
Neilson’s men had the ball in the net on the half-hour mark, with Gary Oliver converting a super Callum Paterson cross however assistant referee Alan Mulvanney flagged for offside.
The moment the noisy band of 229 travelling fans were waiting for came after 40 minutes, with Gold a boyhood Hearts fan who was on the books of Hibs as a youngster latched on to an Alvarez pass and directed a low shot past Hamilton from 12 yards.
The Jambos saw their second goal of the evening chalked of just 60 seconds after the break, with Sow flagged offside after slamming home from close range.
Arbroath were agonisingly close to doubling their lead when Lewis Coult found space on the edge of the box but fizzed his effort inches wide. It proved costly as a remarkable turnaround transpired.
McGhee restored parity after meeting a fine low cross from centre-back partner Alim Ozturk, with the Jambos finally getting the better of Allan Fleming.
Sam Nicholson then provided a wonderful cut-back for Sow, allowing the big forward to tap into the net. Ex-Crystal Palace man Sow made it three goals in four minutes from the penalty spot after Nicholson was felled by Wilson.
Grehan headed home the Lichties’ third, but Wilson turned into his own net as he attempted to clear a low cross.