Having taken the lead in the match, City were beaten 3-2 by the Welsh outfit at the Cardiff City Stadium.
Despite conceding twice from corner kicks, Pellegrini believes that his side were the better team throughout the match.
"I think that we didn't deserve to lose this match," Pellegrini told reporters. "[Conceding] with two corners, it doesn't matter who's guilty, but I think it's too many [to concede] in a match.
"When we scored the first goal, it could be easier for us, because we played against a team who played with ten players inside their box.
"I don't think we played bad. We had the patience to score a goal and we did it. We knew before we came here that Cardiff are a strong team here, and that they didn't lose too many games here last year, but we were optimistic that we could win here and get three points."
City face Hull City in their next match this weekend.