A late Euan Henderson goal proved to be the winner as Andy Kirk's Hearts side beat reserve league leaders Rangers 2-1 at the Oriam.
It took a while for the match to heat up - maybe because of the freezing cold temperatures of the indoor pitch at the Oriam - and it was Hearts who had the first chance of the game after eleven minutes.
Jake Mulraney - who gave his marker problems all day - controlled a long ball from Bobby Burns before firing a shot at Aidan McAdams in the Rangers goal but the keeper saved well.
The Gers tried to get back into it and a winger of their own was also causing Hearts a few issues. Joshua McPake was felled outside the box by Brandon and Stephen Kelly hit the free-kick just over the bar.
Mulraney then had another run at the Rangers back-line and this time he was fouled just inches outside the box on the left-hand side. Cochrane whipped it in low and hard and O'Connor could do nothing but turn it into his own net.
Both Hamilton and Brandon were then booked for fouls on McPake as he tried to get Rangers back into the game but they still could not carve out a clear cut opportunity.
Anthony McDonald then went close for Hearts as the teams edged towards half-time. Dean Ritchie swivelled on the edge of the box and found McDonald who took a lovely touch past Nikola Katic before firing just over the crossbar.
There was another shout for a Hearts penalty just before the break with Katic taking down Mulraney just outside the area. The big Croatian went into the referee's book but then went from zero to hero as he headed Cochrane's goal-bound free-kick just over the bar.
Rangers had the first chance of the second-half when Kelly broke through and his low cut back looked destined to be poked in but Chris Hamilton slid back to clear.
They went close again when it looked like Alex Petkov's header might loop over his own keeper but Colin Doyle managed to paw it out of the sky and claim.
Rangers squeezed in an equaliser just before the hour mark. A low cross in from O'Connor was not dealt with and Andy Dallas poked it home to square things.
The momentum was with the away side and they went close again twice in quick succession. Firstly, McPake picked up a slack backpass and shot at Doyle who saved from close range. Then, Katic nodded down a free-kick at the back post and it was stabbed towards goal, only for Doyle to get a foot to it.
A few substitutes were introduced and it was one of those changes who scored the winner.
Lewis Moore picked up the ball and skipped past a few challenges before cutting a brilliant pass back towards Henderson. The striker took it on his left and fired past McAdams to give Hearts the lead with ten minutes to go.
Rangers tried to come forward but were repelled by a strong Hearts defence, who held on to give them a fantastic win over the leage leaders.
Hearts: Doyle, Brandon (Logan, 73'), Petkov, Hamilton, Hickey, Ritchie, Cochrane (Smith, 60'), Mulraney (Moore, 70'), Burns, McDonald, Currie (Henderson, 60'). Subs: Mason, Gajda
Rangers: McAdams, O'Connor, Patterson, Katic (McClelland, 61'), Finlayson, Palmer, Rossiter (Williamson, 61'), Kelly, Maxwell, Dallas, McPake. Subs: Yates, Balde, Budinauckas