The Scotland international curled home a superb free-kick with five minutes remaining after St Mirren had come from behind to take the lead at Fir Park.
Goals from Conor Newton and Lewis Guy put the Buddies ahead after Michael Higdon had struck first for the home side.
But McFadden had the final say to leave Motherwell three points clear of Inverness in second place and eight points ahead of the chasing pack in the race for a Europa League slot.
Motherwell may well wonder how they were left needing McFadden's late goal to salvage them a result.
They dominated for long periods of the game and could have scored twice before taking the lead.
Higdon sliced an effort wide in the 10th minute before volleying over from McFadden's cross soon after.
However, the striker made amends in the 34th minute by heading home Keith Lasley's cross for his 23rd goal of the season.
St Mirren hung in, though, and were rewarded with an equaliser four minutes before half-time when Newton drove a shot in from 25 yards.
The home side continued on the front foot in the second half but Marc McAusland defected Lasley's shot just over his own bar after some great skill by McFadden had instigated a break, and Craig Samson pushed Chris Humphrey's shot over after the winger had cut inside.
Motherwell were stung when Guy played a one-two with Kenny McLean before finishing past Darren Randolph to give St Mirren the lead with 15 minutes to play.
Motherwell looked set to be frustrated until McFadden conjured his second goal since returning to his first club in February.
McAusland was penalised for a challenge on Higdon 25 yards out and the former Everton winger curled the ball into the top corner with Samson only able to help it into the net.