Having found themselves a goal down, a double substitution paid off at the break for the Shrimps as substitute Jack Redshaw turned home a close-range equaliser within six minutes.
They had to survive a scare when Barry Roche brought down Junior Daniel in a one-on-one to concede a penalty but he guessed correctly to keep out Sam Clucas' low kick down full stretch to his left.
And the points were stolen when Kevin Ellison grabbed the winner to delight his manager.
"I am made up with that," he said. "We had a fantastic start to the season, but we've just had a bit of a sticky spell which every club has.
"But I knew Mansfield were on probably an even worse spell than ourselves and we came here with a game plan.
"I didn't rest anyone from the York game as I wanted to build on that and I thought, overall, we were the better side.
"It went against us with that first goal and I thought it was the right thing to do to make the two changes at half-time, and they really affected the game, Jack Redshaw scoring one and making one.
"Ellison put his head in where few other professionals would for the winner and paid the price. He has had to go to hospital with a facial injury.
"We now have two home games to come and I hope this will have given us our confidence back. We just have to go into every game believing and not look too far ahead."