A Kyle Lafferty brace rescued Kilmarnock from the jaws of a third straight defeat on an emotional day at Rugby Park.
The East Ayrshire side paid tribute to dedicated fan Colin McCue, who sadly passed away after the Ayrshire Derby on Wednesday night, with black armbands and a minute's silence before the match.
A much-needed victory was the perfect way to give Colin's son Scott, who was in attendance, a reason to cheer on he and his dad's beloved team.
Dunfermline looked to be on course for a spectacular win but Northern Irish striker Lafferty ensured the Pars returned to Fife empty-handed.
Steven Lawless broke the deadlock before Lafferty's close-range effort which was followed up by a sublime overhead kick six minutes from time.
The victory was the ideal way to bounce back from disappointing defeats against Arbroath and Ayr United – and it pushed Killie to within two points of the Lichties at the top of the cinch Championship.
Killie boss Derek McInnes was delighted with his side's comeback.
He said: “It was total contrast to through the week where we questioned the spirit of the team a wee bit.
“The first half was evenly poised, two teams playing the same system.
“I was obviously disappointed to lose the goal but the response was everything I’d expect because you’re not always going to get it your own way and it would have been easy for the players to feel sorry for themselves.
“But the belief and attitude to drag themselves back and get in front pleased me no end because that’s what a real spirit is.
“We feel we have generated that. We love working with the players Monday to Friday but real spirit comes from when you are losing games and it can drag you through. We saw that togetherness today from a team who had to contend with 90 minutes through the week.
“I thought the crowd played a part and helped us over the line."
An early double save from Jakub Stolarczyk ensured Killie were kept off the scoresheet in the third minute.
Lafferty took just 12 minutes to get himself in Craig Napier's book after putting an elbow into the face of Efe Ambrose.
Killie were patient in their build up and they were almost rewarded in the 20th minute when Lee Hodson broke down the wing before swinging a low cross into Lafferty but the hitman's flick towards goal was comfortably saved.
Dunfermline were given the perfect chance to take a shock lead when awarded a penalty for handball in the 24th minute but Zach Hemming was the saviour as he saved Lawless' spot-kick.
Pars striker Lewis McCann joined Lafferty in the book for simulation as he tried to buy a second penalty on the half-hour mark.
Blair Alston looked sure to score when Fraser Murray squared it to him in the 53rd minute, eight yards from goal, but the midfielder fluffed his lines with a spectacular miss.
Just before the hour mark, the visitors took the lead when McCann delivered a ball across to Lawless who happily fired an effort into the roof of the net.
Killie roared back thanks to that man Lafferty who shot home in the 67th minute after being fed the ball on a plate from Alston who made up for his earlier miss.
Lafferty had a fantastic chance 10 minutes later but he couldn't get a touch on a ball that was fizzed across the face of goal.
However, he did double his tally in the 84th minute in stunning fashion with an acrobatic effort that left Stolarczyk helpless.
Don't miss the latest Ayrshire headlines – sign up to our free daily newsletter here