Caretaker boss Viv Busby, in charge at Bootham Crescent for the first time, saw his side beat second placed Carlisle United 2-1 with goals from Lee Nogan and Dave Merris.
The defeat was Carlisle's first this season away from home.
After a quiet start with little goalmouth action, the game suddenly exploded after 21 minutes, when Peter Murphy was sent off for violent conduct against Paul Groves.
Andy Bishop was a handful for the United defence and he twice fired in efforts which brought fine saves from goalkeeper Matt Glennon. The Carlisle keeper also saved well from defender Shaun Davies who got forward to fire in an angled volley from 15 yards.
Carlisle's solitary chance of the opening period came courtesy of a Brendan McGill header which flew a yard over.
City were boosted by scoring a minute before the interval. A right wing cross found Merris and his low cross-shot was nudged home by Nogan from no more than two yards out.
Three minutes after the re-start City lost Bishop through injury and became less of an attacking threat.
However, defensively, they performed exceptionally well with Lee Grant outstanding.
Despite Carlisle's dominance after the break City doubled their lead in the 69th minute. Nogan and Lev Yalcin helped the ball forward and Merris outpaced defender Brian Shelley to poke the ball past the advancing keeper from 15 yards.
Carlisle rallied strongly again and substitute Kevin Henderson scored from close range three minutes from time following a goalmouth scramble.
With four minutes of additional time City were forced to defend throughout but held on for a deserved and much-needed victory.