McEwan steered York away from relegation with a 17th-place finish in 2004–05, and his rebuilt team finished eighth the following season. York reached the play-offs in 2006–07, but were beaten 1–0 on aggregate by Morecambe in the semi-final. With home form poor McEwan was dismissed in November 2007, and his assistant Colin Walker took over as caretaker manager before being appointed permanently in December. After only five wins from the first 19 matches of 2008–09, Walker was dismissed in November 2008, and was succeeded by former Port Vale manager Martin Foyle. York avoided relegation in the penultimate match of the season and reached the 2009 FA Trophy Final, in which they were beaten by Stevenage Borough. Foyle's York lost to Oxford United in the 2010 Conference Premier play-off Final, and he resigned in September 2010 with the team 15th in the table 10 matches into 2010–11.