Andy Driver's second-half header gave Hearts their first league win of the season over Aberdeen in a thrilling encounter at Tynecastle.
The Dons had taken the lead through a glorious Darren Mackie volley but Hearts had levelled with a great move finished off by Christian Nade in first-half injury time.
And Driver came rushing in at the back post midway through the second half to seal the points with his low header to keep Hearts' UEFA Cup dreams alive.
Hearts untried central defensive pairing of Eggert Jonsson and Christos Karipidis were immediately under pressure as Javan Vidal released Mackie with a fine pass.
Jonsson was caught napping, but was helped out by keeper Janos Balogh who raced from his box to clear the danger.
And another long through ball from Ricky Foster found Mackie racing clear of Jonsson, but the ball bounced awkwardly and Balogh came out to save Hearts again.
Hearts' first chance fell to Nade who raced on to Zander Diamond's attempted header back to Jamie Langfield. Nade reached the ball first but Langfield spread himself to smother the strikers attempted lob.
The visitors hit the front after 18 minutes with a fantastic goal. Charlie Mulgrew hit a 50-yard diagonal pass and Mackie ran clear of Jonsson to hammer in a brilliant right-foot volley that soared into the roof of the net from 15 yards
Hearts attempted to come back straight away with Gary Glen testing Langfield from the edge of the box but Bruno Aguiar was high and wide with a 25-yarder.
However, the Dons continued to create the clearer chances and a great turn and shot at the edge of the box from Lee Miller forced Balogh to parry the ball back to Diamond who missed a great opening from eight yards.
Hearts hit back again in a spell of pressure that saw David Obua force a fine save from Langfield with a curling 20-yarder and Michael Stewart also tried a volley from distance that was well struck but always too high.
It was an enthralling encounter and a clever chipped pass from Aguiar allowed Gary Glen to fire in a first time effort that was too close to Langfield who was able to gather.
But right on half time Hearts fashioned a fine equaliser. Aguiar picked out a brilliant pass that Obua won at the back post and his header back across goal was perfect for Christian Nade to head home from close range.
And on balance honours even at the interval was about right.
Aberdeen threatened first in the second period with Diamond powering in a header from Mulgrew's free-kick. Balogh looked wrong footed but moved smartly to his right to save.
But it was Hearts who took the lead after 66 minutes. Obua was the creator again with a low cross from the left. Mulgrew went to sleep at the back post and Andy Driver arrived to bundle home a header that squirmed under Langfield.
Substitute Tommy Wright had only just joined the action when Lee Miller won a towering header, but Wright was off-balance and sliced the chance high and wide.
And the Hearts goal was under siege as Chris Maguire's shot was deflected inches wide before Maguire cut in from the left to fire a drive off the base of Balogh's post.
But in the end Hearts hung on for a vital win.