The Hammers were 2-0 up and cruising against Cardiff with just seven minutes gone thanks to goals from Ravel Morrison - after just 20 seconds - and Matt Jarvis.
But they wasted a host of chances to kill City off, and the team who inflicted a home defeat in Allardyce's first game at the helm two years ago threatened to repeat the trick as they drew level through Craig Noone and Peter Odemwingie.
That was until Ricardo Vaz Te popped up with a late winner to secure a 3-2 win and ensure Allardyce could toast his century in style.
"It should have been all over at half-time," admitted assistant boss McDonald. "That's the most disappointing thing. We played some brilliant stuff in the first half, we got the early goals and created chance after chance after chance, but we didn't finish them off.
"We probably thought it was too easy and took our foot of the pedal. And Cardiff scored a great goal just before half-time.
"When you are on the back foot after conceding just before half-time it changes everything. People come in expecting a pat on the back but instead we gave them a talking-to.
"To be fair to Cardiff they got the equaliser but we stuck together, we worked hard for each other and we'll take a late winner and a 3-2 win.
"It's always good to win and Sam is pleased we are through, although he's slightly disappointed with some aspects."