Livingston and Hearts were both desperate for a victory from this encounter but the visitors grabbed all three points with a dramatic winner by Kevin McKenna seven minutes from time.
Third-placed Hearts went into this Scottish Premier League game with Livingston looking to stretch their lead over fourth-placed Dunfermline to nine points ahead of the two sides' meeting on Saturday.
But the Tynecastle outfit knew they would have to change a record of no league wins at Almondvale. With that in mind, the manager, Craig Levein, fresh from defending his team's physical approach to matches, made two alterations from the side that beat Dundee United 3-1 at the weekend.
The former Middlesbrough midfielder Phil Stamp, struggling with a knee injury, dropped down to the bench along with the striker Dennis Wyness, to be replaced by Neil MacFarlane and the Northern Ireland international Andy Kirk.
Livingston, looking to bounce back from Saturday's 1-0 defeat to Dundee, made one enforced change, with Jamie McAllister succumbing to a hamstring injury to be replaced by the striker Colin McMenamin.
Livingston were in need of a boost on the field after their recent lurch into administration.
They were first to settle and got the early breakthrough with five minutes gone. McMenamin, looking to make an impression on his first start of the season, wriggled clear of two challenges before being fouled by Steven Pressley on the edge of the box.
The former Hearts midfielder Lee Makel made the Gorgie captain pay for his mistake when he stepped up to curl the free-kick round the wall and into the corner of Craig Gordon's net.
Hearts were forced into the game's first substitution in the 21st minute as Paul Hartley limped off to be replaced by Stamp in midfield. He added some urgency to the visitors' play and four minutes later they were level.
The Canadian international Kevin McKenna, playing on the right side of a Hearts back three, launched a long pass from the halfway line, giving De Vries the time to line up the header, jump above a static Rubio and find the back of the net from six yards out.
With 10 minutes to go to the break, McKenna was presented with a gilt-edged chance to give his side the lead as he beat the offside trap to get his head on MacFarlane's chipped cross but McKenzie got across goal to save. Five minutes later, Stamp had McKenzie scrambling across his goalmouth as he speared in a powerful 30-yard drive inches wide.
Hearts took the lead only 90 seconds after the restart. Stamp took a short free-kick in midfield and strode forward before unleashing a ferocious drive from 30 yards. McKenzie got across to block the effort but his parry fell at the feet of Andy Kirk, who swept the ball home from just inside the box.
De Vries sent a dipping shot just over in the 53rd minute before Livingston were denied an excellent chance by an offside flag as McMenamin prepared to shoot. Livingston did manage to find an equaliser in the 56th minute, however.
With three defenders around him, David Fernandez did brilliantly to curl a cross to the back post, where Makel's challenge succeeded in knocking the ball back into the danger area. McMenamin was the first to react at the edge of the six-yard box, leaving goalkeeper Craig Gordon stranded.
Levein responded by switching to a flat back four, with McKenna moving into midfield. De Vries came close to giving his side the lead again in the 62nd minute as McKenna's header allowed him to put his own header in on target, only for McKenzie to pull off the save.
Four minutes later, it was McKenna who was almost on target as he capilitalised on a Marvin Andrews mistake but sent his volley just wide of McKenzie's left-hand upright.
Levein sent on Robert Sloan for Neil MacFarlane and Dennis Wyness for the tiring De Vries as Maybury and David McNamee picked up deserved bookings after a running feud.
The Lions manager, Davie Hay, also introduced fresh legs, sending on the Argentinian striker Fernando Pasquinelli for McMenamin.
Stamp continued to burst forward and he sent a fierce volley just over 10 minutes from time as the home rearguard failed to deal with a high ball. And it was a defensive lapse which saw the Edinburgh side head home with all three points. McKenzie came and flapped at Sloan's inswinging corner and, in a crowded goalmouth, McKenna reacted first to nod the ball in.
Livingston: McKenzie, Rubio, Dorado, Andrews, McNamee, Makel, Lovell, O'Brien, Fernandez, McMenamin (Pasquinelli, 78), Lilley. Substitutes not used: Main, McGovern, McLaughlin, Brittain.
Heart of Midlothian: Gordon, Pressley, McKenna, Webster, Maybury, Hartley (Stamp, 21), MacFarlane (Sloan, 67), Kisnorbo, Neilson, De Vries (Wyness, 71), Kirk. Substitutes not used: Moilanen, Janczyk.
Referee: I Fyfe.