Dundee suffered late heartache at Tynecastle after throwing away a 2-0 first-half lead.
Jordan McGhee and Lyall Cameron goals put the Dark Blues in front at the break before hosts Hearts turned the game on its head second half.
Goals from Calum Nieuwenhof, Dexter Limbisika and Yutaro Oda on 86 minutes completed the Jambos comeback.
Wind swirled around Tynecastle with Storm Jocelyn doing her work in the capital, rain joining in sporadically on a horrible night.
It was worth the journey for the hardy band of travelling Dees early on as they saw their side take a 2-0 first-half lead.
Moments after Zander Clark had pulled off a top save to deny Zach Robinson’s header, Jordan McGhee fired his side in front.
The offside flag threatened to spoil his super finish against the side he spent 10 years with but VAR ruled the goal would stand.
Lyall Cameron then made it 2-0 on 38 minutes.
Dara Costelloe pounced on a loose Hearts pass, nicked the ball beyond the Hearts defence for Cameron to turn the ball beyond Clark and into the corner.
The Dark Blues weren’t able to hold that lead, however, as Hearts dominated the second period.
Luke McCowan limped off shortly after the break before Calum Nieuwenhof found space 25 yards out and sent the ball unerringly into the bottom corner.
Hearts had the chance to make it 2-2 on 64 minutes after a lengthy VAR check saw Owen Dodgson penalised for a push on Shankland.
The Scotland striker, though, saw his spot-kick superbly saved by the sprawling Trevor Carson.
The equaliser did finally come on 73 minutes, however. Alan Forrest turned McGhee and crossed to the far post for Wolves loanee Limbikisa to head home.
Five minutes later referee Chris Graham pointed to the spot at the other end after Malachi Boateng was felled by Craig Halkett. VAR, though, said it was outside the area.
And with 86 minutes on the clock, the home turnaround was complete as substitute Oda saw his shot find the top corner to the despair of the Dark Blues.
Tony Docherty made five changes from Saturday’s Scottish Cup disappointment at Kilmarnock.
Most notable was the return of Trevor Carson in goal while Owen Dodgson, Cameron, Malachi Boateng and Zach Robinson all came in.
Out were Adam Legzdins, Ryan Howley, Mo Sylla, Josh Mulligan and Scott Tiffoney.
The system stayed the same, however, and matched Hearts’ 3-5-2.
Despite struggling defensively at Killie, Costelloe started once more at left wing-back and did OK.
That saw Dodgson make his full debut on the left of the back three while McGhee moved back to right wing-back, where he has played much of the campaign.
First half, there was a lot more fluency in the performance capped with some clinical finishing.
Second half, however, it was all Hearts with the Dark Blues unable to mount much of an attacking threat.
Victory would have been welcome because there haven’t been many of late for the Dark Blues.
That’s one win in eight matches now since the 4-0 thumping of St Mirren.
Not just a loss, this defeat was a kick in the guts for this young Dundee squad after such a positive first half.
Livingston on Saturday is a big, big game.
There’s plenty of focus on Dundee’s new left-sided Owen. Dodgson is part of the new Burnley revolution.
He wasn’t, though, tasked with taking on the role performed with distinction by the departed Owen Beck.
Dodgson instead lined up in the back three to one side of Joe Shaughnessy and with team-mate and house-mate Costelloe to his left.
At times he showed he can play a bit. Vitally, though, he showed he’s up for a defensive scrap with some strong tackling.
The second-half was a learning curve for Dodgson, however, and he’ll need to learn quickly to avoid pushing in the area with VAR around.
Early signs do look encouraging for the youngster, though.
Hearts: Clark, Kent, Halkett, Kingsley, Lembikisa, Baningime (Tait 56), Denholm (Forrest 32), Nieuwenhof, Cochrane (Grant 46), Vargas (Oda 73), Shankland.
Subs not used: Gordon, Sibbick, Pollock, Tagawa, Wilson.
Dundee FC: Carson 7, Shaughnessy 7, Ashcroft 6, McGhee 7, Costelloe 7, Dodgson 6, Boateng 7, Cameron 7, McCowan 6 (Mulligan 48, 6), Bakayoko 6 (Reilly 80), Robinson 6 (Main 70, 6).
Subs not used: Sharp, Astley, Tiffoney, Robertson, Howley, Sylla.
Referee: Chris Graham