Bjorn Johnsen opens his Hearts account to secure win over Dundee
Bjorn Johnsen netted his first goal for Hearts as they rode their luck to overcome Dundee in a pulsating encounter at Tynecastle.
The American striker climbed off the bench to wrap up the victory a minute from time after Scotland defender Callum Paterson had headed the hosts in front in the 68th minute.
But Dundee will feel aggrieved that they left the capital with nothing to show for their efforts after striking the woodwork several times.
The win lifts Hearts above Rangers into third place in the Ladbrokes Premiership, while Paul Hartley's Dundee slipped to the basement.
Paterson might have scored, but he was lucky he did not gift Dundee a goal right from kick-off.
His slack pass back was pounced on by Faissal El Bakhtaoui but John Souttar spared his team-mate's blushes after sliding on to concede a corner.
Aside from a James Vincent free-kick that clipped the bar in the 21st minute, Hearts dominated possession and chances during a one-sided half.
But a combination of poor finishing and good goalkeeping from Scott Bain ensured the score was goal-less at the break.
Bain was called into action as early as the sixth minute to charge down a Conor Sammon shot after Kevin Gomis was dispossessed.
Paterson then hit a low drive into the side netting before Tony Watt glanced a close range header over.
Former Celtic forward Watt struck another effort over the bar before Don Cowie hit a shot off target from inside the area.
Bain then denied Arnaud Djoum with a low save before keeping out Paterson's downward header from a Cowie corner.
Dundee made a strong start to the second half and were unlucky not to take the lead after striking the woodwork three times.
Tom Hateley's half-volley from the corner of the box took a slight deflection off Igor Rossi before coming back off the far post.
Defender Kostadin Gadzhalov's header then struck the bar from Vincent's corner before Yordi Teijsse's low shot from outside the box rebounded off the post.
Amid those chances for the visitors, the Hearts fans did not take to kindly to see Watt being substituted for Robbie Muirhead, with some supporters booing that decision.
However, it was Muirhead that set-up Hearts' opening goal in the 68th minute.
The former Kilmarnock and Dundee United player swung a free-kick into the area and Paterson rose high to direct his header into the far corner.
The goal came when the Dens Park club were enjoying their best spell in the game.
That effort eased the tension among the home fans and their team began to settle on the pitch. Souttar headed a Cowie corner over before a rising drive from Djoum was held by Bain.
Dundee still looked a threat from set-pieces and Teijsse wasted another chance five minutes from time when the unmarked Dutchman headed Cammy Kerr's corner wide at the back post.
But Hearts substitute Johnsen wrapped up the win in the 89th minute after connecting with Walker's low cross at the near post.
Hearts goalkeeper Jack Hamilton kept a clean sheet with a stunning one-handed save in injury-time to deny Rory Loy.