City substitute Kei Kamara scored his first goal in English football with six minutes left to cancel out Leon Osman's first-half header for Everton.
Chris Hughton's hard-working side were not finished yet, though, and secured a first Barclays Premier League win since December 19 when Grant Holt stabbed home at the far post deep into injury time.
Defeat was somewhat harsh on Everton, who had been the better side for long spells, with Marouane Fellaini central to all their attacking threat.
Moyes said: "We had controlled the game but were wasteful in the second half when we had chances to get another goal and we were always going to be put under pressure at the end.
"I cannot understand why he [referee Lee Mason] plays three minutes and 20 seconds for the stoppage time but he has got that discretion, although I disagree with it.
"We passed it well enough and tried to do the right things but we were not good enough in the final third - but one thing is for sure, we did not deserve to lose."
Everton remain in sixth place, six points adrift of Tottenham, who play at West Ham on Monday night.
"There is still chances for us to do it (get into the top four) but we are going to have to be very good to do it," Moyes said.
"However, we should have seen this one out, if we have any real ambitions, then we have to make sure we do not lose that game."