West Ham moved into the fourth round of the FA Cup with an edgy victory but the main talking point was a mild strop from Marko Arnautovic, who reacted to his early substitution by mooching off the pitch with the demeanour of a sulky teenager.

Having given West Ham control of a tense tie against spirited and robust opponents, Arnautovic was unimpressed when he saw his number being held up in the 20th minute. He flung his arms in the air, ignored Michail Antonio’s attempts to console him and questioned why Manuel Pellegrini had opted for a safety-first approach after learning his best forward had felt a twinge in his back.

There was no swaying Pellegrini and it is impressive that the West Ham manager refused to be cowed by Arnautovic’s force of personality. Pellegrini is paid to make the tough calls and he poured cold water on the episode. It was a simple decision as far as he was concerned: there was no point taking any unnecessary risks given Arnautovic missed most of the festive period with a hamstring injury.

“It is not very important,” Pellegrini said. “It was better to change him because he is just coming back from an injury. He could continue but it was better to protect him. He was angry for one minute.”

Nothing to see here, then. Pellegrini was not about to pick a fight with one of his leading players, not least because Arnautovic’s importance became even more apparent after he reluctantly made way for Andy Carroll. West Ham toiled without the Austrian and although they played with enough professionalism to dash Birmingham’s hopes of forcing a replay, they could relax only when Carroll scored a trademark header in the 90th minute.

With the away fans making plenty of noise, this was a competitive tie. While Birmingham face the prospect of a points deduction after revealing huge losses in their accounts, Garry Monk’s side have risen to eighth in the Championship and the chance to get one over their former owners, David Gold and David Sullivan, added spice to the atmosphere.

However, the early signs were ominous for the underdogs. West Ham made an intense start and the opening goal arrived after two minutes. Monk called it a poor one to concede. Harlee Dean gave Angelo Ogbonna too much room from Grady Diangana’s corner and nobody in blue reacted in time when Lee Camp repelled the centre-back’s header. Birmingham’s goalkeeper was entitled to wonder why none of his defenders attacked the loose ball with any urgency. Even Arnautovic seemed surprised at how easy it was to head into the unguarded net for his third goal in two games.

Arnautovic’s departure energised Birmingham. Xande Silva, a young Portuguese forward, struggled to click with Carroll and Birmingham targeted Antonio’s weaknesses at right-back. They almost equalised when Gary Gardner played a one-two with Lukas Jutkiewicz on the left and found space in the area, only to shoot against Arthur Masuaku.

Birmingham deserved to be level at the break. Jutkiewicz had a towering header cleared off the line by Carroll and Maikel Kieftenbeld fired just wide. Connor Mahoney beat Masuaku with a silky manoeuvre, only for Antonio to stop the winger’s inviting cutback from reaching Gardner.

West Ham lacked leadership after resting Mark Noble and Pablo Zabaleta, while Samir Nasri struggled to influence the game before being substituted in the 59th minute. Nasri, available after serving an 18-month doping ban, will need time to show why Pellegrini pushed for his arrival on a free transfer.

As the minutes ticked away a blunt edge hurt Birmingham’s determined push for an equaliser and Wes Harding let himself down with a heavy touch after bursting through on goal in the closing stages.

At the other end Carroll fired against the bar from close range. He then overran the ball after rounding Camp. At least he made amends when he headed home Antonio’s cross to score for the first time since last April but West Ham had spent most of the tie pining for Arnautovic.