It felt like it was going to be a moment that summed up West Ham's tragicomic season. They were 2-0 up and coasting in the second half, a crucial win in their battle against relegation was on the cards and sparks were flying again in one of football's great bromances, Andy Carroll creating two goals for Kevin Nolan. Things were looking up for once.

Few clubs have as vast a capacity for self-destruction as West Ham, though, and when Carroll was sent off after a clash with Swansea's Chico Flores, whose preposterous reaction to being caught by a stray arm on the top of his head convinced Howard Webb to show the red card, three crucial points were in danger of being thrown away. A narrative was being established.

Not this time, though. Instead, in the face of relentless pressure from Swansea City, West Ham dug in and clung on for a priceless victory in which they had to just as resilient as they were in Wednesday's 0-0 draw at Chelsea. These are the occasions when supporters might appreciate having Allardyce as their manager. By the end, West Ham were playing with three centre-backs after Winston Reid had made his return from an ankle injury after coming off the bench, although they face losing Carroll for three matches unless they win their appeal against his red card.

"It's the reaction of the player that makes life extremely difficult for the referee," Allardyce said. "He must have thought the arm smashed him in the face and we all know it hasn't. All I can hope is that in the cold light of day the panel see it for what it is.

"His arm's gone over the top of his head and while his arm's swinging round, coming from a position where both players have tangled and are coming round to correct their balance, there were players running round to obscure his [Webb's] view. So he can't be absolutely certain of what's happened, except that Chico Flores is over-exaggerating, which is generally the norm for him unfortunately."

West Ham's unapologetic defensiveness led to Jose Mourinho accusing them of playing 19th century football at Stamford Bridge for much of the first 25 minutes against Swansea, West Ham were leggy, carrying all the threat of a Penny Farthing. There 22 players, a referee and a ball on the pitch – all the ingredients required for a match – but nothing happened. James Tomkins volleyed over from the edge of the area, Gerhard Tremmel sliced a clearance out for a throw and that was about it. It was tepid stuff.

But West Ham's opener after 26 minutes had a reassuringly familiar feel to it, a sense that everything was going to be fine after all, because Carroll and Nolan were together again. George McCartney lifted a cross from the left towards Carroll, who headed down for Nolan to control with his chest and then hammer a left-foot volley into the bottom-left corner from 15 yards. It was the kind of chance Nolan has been missing all season; Carroll's presence has clearly had a revitalising effect on him.

Swansea, who were toothless without Michu, are in trouble based on this lethargic performance. They did not have a shot on target and their most dangerous moment was when Wilfried Bony burst through on goal and was denied by a tackle from James Tomkins that Webb ruled was clean. Replays were inconclusive but the direction of the ball suggested it was the correct decision.

Michael Laudrup had played Jordi Amat in front of Swansea's defence to combat Carroll and Nolan but the plan did not work. Just before half-time, Carroll, playing like a man possessed, harried Ashley Williams into conceding a needless corner on the right. Stewart Downing swung it to the far post, Carroll headed it back and Nolan headed it in from three yards out. Carroll and Nolan, wreaking havoc again, just like old times. "We struggled to cope with them physically," Laudrup said.

Then came Chico's late Oscar bid. After Webb failed to award West Ham a free-kick when the Spaniard clambered all over Carroll, the Swansea defender fell to the ground and rolled around as if he had been elbowed in the face, rolling around in agony. Unfortunately for West Ham, Webb bought it. "He's gutted," Allardyce said of Carroll. "He's absolutely beside himself. It hasn't cost us anything via the actions of the brilliant 21st century defending of the players."

Indeed for all Swansea's possession, they rarely threatened West Ham. The 10 men's indignation saw them over the line.