Brian McLean's late winner kept Motherwell in the hunt for a top-six finish but dealt a blow to Livingston's hopes of avoiding relegation.
Brian McLean (right) scored Motherwell's winner
Richie Foran missed a penalty before Jim Hamilton headed the opener during Motherwell's first-half dominance.
Foran hit the crossbar, but Livi substitute Noel Whelan finished from six yards from Steve Hislop's set up.
However, McLean headed home a Phil O'Donnell cross before Whelen had an effort cleared off the Motherwell line.
It was a deserved victory that puts Well a point behind sixth-placed Aberdeen with one game remaining before the Scottish Premier League splits for the final five games.
Hislop and fit-again defender Harald Pinxten had returned for Livingston in place of the suspended Manu Dorado and injured David McNamee.
And Hislop was first to threaten, connecting with a Wes Hoolahan cross and his sweetly-struck effort brought a fine save from Smith.
But Motherwell came more into the game and Hamilton, who had returned to Terry Butcher's side along with goalkeeper Graeme Smith, outmuscled Greg Strong to head just inches over.
Former Well defender Strong was again at fault when he was deceived by Scott McDonald 10 yards from goal and referee Eddie Smith had no hesitation in pointing to the spot.
But Foran's weak side-footed effort was saved by Roddy McKenzie and the Irishman scuffed his follow-up attempt.
Jim Hamilton put Motherwell ahead against his former club
McDonald raced clear of Pinxten, rounded McKenzie but had his attempt cleared off the line by the Belgian defender.
Livi were forced into a change on the half-hour mark when Derek Adams limped off to be replaced with former Celtic midfielder Colin Healy.
And Motherwell continued to dominate, with McDonald heading on to the roof of the net then dragging a shot wide.
Motherwell finally got the opener when former Livi forward Hamilton headed home O'Donnell's clipped cross with aplomb at the back post in the 40th minute.
Foran nearly made it 2-0 on the stroke of half-time when he hit the crossbar with a header.
Livi boss John Robertson was forced to replace the injured Hoolahan and Pinxten at half-time.
The introduction of Gary Miller and Whelan produced more of a threat and Martyn Corrigan's firm back-header forced Well keeper Smith to acrobatically claw the ball away from danger in the 63rd minute.
Motherwell would have doubled their advantage had McKenzie not brilliantly saved O'Donnell's thunderbolt moments later.
Recent Livi signing Whelan flicked in a surprise equaliser after Hislop knocked on a Richard Brittain cross.
But McLean grabbed a deserved winner in stoppage time.
Motherwell: Graeme Smith, Corrigan, Craigan, McLean, Hammell, McBride (Paterson 78), McCormack, O'Donnell, Foran, Hamilton (Clarkson 81), McDonald.
Subs Not Used: Meldrum, Kerr, Leitch, McGarry, Kinniburgh.
Goals: Hamilton 40, McLean 90.
Livingston: McKenzie, Mackay, Strong, Pinxten (Miller 45), Brittain, Hoolahan (Whelan 45), Adams (Healy 31), Walker, Tierney, Morrow, Hislop.
Subs Not Used: Roy, Snodgrass, Dorrans, Scott.
Booked: Whelan, McKenzie.
Goal: Whelan 76.
Ref: E Smith