Goals in each half from Morgan Amalfitano and Diafra Sakho put Sam Allardyce's energetic West Ham side 2-0 up with 15 minutes to go at Upton Park.
David Silva produced a moment of magic to reduce City's arrears shortly after Sakho had scored his sixth Premier League in as many starts this season, and Pellegrini's team piled on the pressure in the closing stages in search of an equaliser that never came.
Sergio Aguero and Yaya Toure both hit the crossbar with the score at 1-0 as City moved through the gears after half-time.
The champions' second-half performance was much livelier than their display before the break, but Pellegrini was left to rue some uncharacteristically wasteful finishing from his side as they fell to a second league defeat of the season.
"I don't think we deserved to lose this game. We had two or three clear chances where we could have scored," said the Chilean.
"I think West Ham played very well [in the] first half [and] we improved a lot in the second. But if you don't score, you can't win."
City were lacklustre in the first half, but Pellegrini refused to blame their below-par performance on a hangover from the midweek UEFA Champions League trip to CSKA Moscow.
"If we played how we did in the second half in the first half we might have been able to say [that the journey to Russia had an effect]," he added.
Saturday's defeat leaves City five points behind Premier League pacesetters Chelsea, who can extend their advantage when they travel to Manchester United on Sunday.
However, Pellegrini is refusing to press the panic button, pointing out that there is a long way to go in the season.
"[We have] 87 points to play for [and] we are second in the table," he continued.
"I repeat, we had a very undeserved defeat today."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.