Foden (pictured) produced the winner five minutes from time in an eventful encounter at Goodison Park.
Everton had looked on course for victory after racing into a two-goal lead thanks to first-half goals by Fraser Hornby and Con Ouzounidis.
But City rallied in the second half through Foden, and two goals in six minutes by Nmecha.
City defender Joel Latibeaudiere was dismissed for a second bookable offence and within five minutes Everton made it 3-3 through Shayne Lavery.
But Foden had the final say with a fine left-footed strike.
The win lifts City up to seventh place while Everton are in sixth, seven points behind leaders Leicester City.
The Toffees have to win their remaining three matches to have a chance of retaining the title.
Everton: 9 April v West Ham (H)
Man City: 5 April v West Ham (H)