Midfielder Harry Pell netted 11 minutes from time as the hosts climbed from bottom to 21st in the table and also ensured Nigel Worthington's reign as Minstermen boss got off to a losing start.
Chris Smith had earlier twice clawed York back, equalising shortly after Mat Mitchel-King's strike in the 21st minute and Brennan Dickenson's on the hour, but it was not to be.
The Dons are now two points above the drop zone, however boss Ardley is not getting carried away with the implications of the result and is determined to keep everyone's emotions in check.
"We tried to stay calm and when they pegged us back twice, we kept the information from the bench positive and fair play to the boys because they showed great character," he said.
"Obviously you worry that it's another decent home performance where we're the better team and haven't come away with a win.
"We were the better team throughout the game and we deserved the win but when you're down where we are you can get nervous and give away silly little fouls that cause problems.
"But I've got a bunch of players who are giving absolutely everything and care what happens. I can't ask for more than that.
"If you look at the magnitude of the situation a home win is absolutely vital and we had to stay calm. We were in control of our performance; we're not going to worry about other teams.
"The win is great for the fans but I haven't looked at the table. We need four more wins, that's what I keep saying."