Hearts went top of the cinch Premiership but it was the Dundee fans who were celebrating at Tynecastle after Jason Cummings headed a late equaliser.
John Souttar curled home an impressive 20-yard effort to put Hearts ahead at half-time but they could not really build on their lead, although they hit the frame of the goal for a second time after the interval.
The hosts kept Leigh Griffiths quiet but it was another former Hibernian striker that did the damage in the 1-1 draw in the 83rd minute.
Cummings, a former Hearts youth player, glanced home from close range after meeting Cammy Kerr’s long throw and the visitors held on.
Hearts went top on goal difference but Rangers now have the chance to go three points clear when they play St Mirren in Paisley on Sunday.
Tynecastle boss Robbie Neilson watched the action from the front row of the press box, immediately behind the home dugout, after his Ibrox red card led to a three-match touchline ban.
Neilson kept an unchanged team following that draw in Glasgow while James McPake brought in Max Anderson for injured midfielder Shaun Byrne.
Griffiths was the centre of attention as the teams came out and he nearly silenced the home fans when his volley shaved the bar, but the offside flag was raised anyway.
Hearts were generally pushing Dundee back with Ben Woodburn heavily involved in the home side’s early play but Craig Gordon made the first save of the game when he held Luke McCowan’s shot.
Hearts came closer when Liam Boyce headed Michael Smith’s corner off the bar and Griffiths cleared off the line as Craig Halkett followed up.
The hosts took the lead in the 37th minute after Charlie Adam’s attempted nutmeg failed to come off midway inside his own half.
The ball fell for Boyce, whose shot was blocked and the ball was eventually rolled back to Souttar, who sent a curling first-time shot away from the goalkeeper and into the top corner.
Dundee almost got caught again before the break when Barrie McKay won the ball inside the visitors’ box and cut it back for Boyce, whose shot was blocked.
Gary Mackay-Steven replaced Woodburn at half-time and Boyce limped off for Armand Gnanduillet on the hour – but Hearts remained on top. The first substitute soon hit the post on the rebound after teeing up Smith.
The second biggest cheer of the day from the Hearts fans came when Griffiths was substituted in the 69th minute. His replacement, CiIlian Sheridan, forced a decent stop from Gordon when he let fly after a long ball.
With only one goal in it, Dundee grew in belief and Cummings came back to haunt Hearts when he nodded into the far corner of the net.
The equaliser sparked some tense moments behind the goal as some of the celebrating visiting fans moved towards the home support and missiles were thrown.
With McKay off for Josh Ginnelly, Hearts had an all-new attacking trio and they could not force a clear chance to get a winner.
STV News is now on WhatsApp
Get all the latest news from around the countryFollow STV News
Follow STV News on WhatsApp
Scan the QR code on your mobile device for all the latest news from around the country