The game was held up for 10 minutes in the first half while paramedics dealt with Frenchman Demel after he was caught by an accidental elbow from team mate Roger Johnson.
West Ham have been stricken by injuries to defenders and their worries at the back further increased when Tomkins was dismissed for two bookable offences in his first game back after injury.
Allardyce, who saw his side beaten 5-0 at Nottingham Forest in the FA Cup last weekend and 6-0 at Manchester City in the League Cup in midweek, refused to talk to the media after the victory over Cardiff.
"That was massive," captain Mark Noble told reporters. "We have been poor lately, we have been embarrassed in two cup games and this is a tough place to come but we have lost a man and still managed to win.
"Every shot they had went straight to our goalie and they had a deflected shot just stay out so we have had a bit of luck that we have not had recently."
Carlton Cole put West Ham in front in the first half and Noble secured victory in stoppage time at the end of the match.
Noble's goal came after good work by substitute Andy Carroll, the fit-again England striker having come on for his first appearance of the season in the second half.
Allardyce has cut a lonely figure on the touchline in recent weeks as media speculation mounted about his job.
The West Ham board, however, gave him their full support in an open letter to fans on Tuesday.
"We have a good bunch of lads who work for each other and now, with players coming back, we are looking forward to the next few games," said Noble.
West Ham are one spot above the relegation zone in 17th position, level on points with 18th-placed Cardiff.