The hosts surrendered a two-goal lead at Upton Park before a late Ricardo Vaz Te header earned them a place in round four.
They have now scored five goals in two matches, having failed to find the net in their previous three Premier League matches.
And McDonald was buoyed by their new-found confidence in front of goal.
"We've scored goals, which is great," he told the club's official website.
"I thought we totally dominated the first half, went 2-0 up and it became a little bit too easy for the players and they took their foot off the pedal.
"We had a lot more chances in the first half to finish the game off altogether, but we didn't take them and they scored a fantastic goal just before half-time which put us on the back foot.
"Second half, we didn't really hit the ground running as we did in the first half and that gave Cardiff encouragement. They got back to 2-2, but we showed a lot of character and that we wanted to win the game.
"We counter-attacked and a great ball from Jack Collison to Ricardo Vaz Te allowed us to finish it off."