The 21-year-old midfielder struck home from the edge of the box 11 minutes from time to lift the Dons from 24th to 21st and ensure Nigel Worthington's reign as York manager 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 for the Minstermen.
Dons captain Mitchel-King gave the hosts an early lead with a well-placed half-volley that sailed into the top corner of Michael Ingham's net but Smith headed an equaliser eight minutes later.
Dickenson reinstated the Dons lead by taking the ball around Ingham and passing it into the middle of an empty net following a Jack Midson flick on.
Smith levelled the scores again by bundling in a free-kick from Pat McLaughlin's free-kick that beat everyone before reaching him at the far post but then came Pell's strike off a post.