Noble cause: The West Ham midfielder scores from the penalty spot to make it 2-0
The official ruled that Michael Nelson handled the ball inside the box, when TV replays clearly showed it was a yard outside. Mark Noble dispatched the spot kick to end a first half during which the League One side had ruffled the London side's feathers on more than one occasion.
Only a Scott Parker goal-line clearance denied a Michael Mackay header in the ninth minute and Andy Monkhouse twice went close with long-range efforts.
West Ham were also fortunate when Carlton Cole escaped with only a yellow card in the 39th minute after he went in hard and late on Arran Lee-Barrett after he had clearly collected the ball. The goalkeeper's instant retaliation sparked off a melee with most of the players joining in. Herita Ilunga's eagerness to gallop the length of the field to get involved earned him a yellow card.
In the thick of it: Carlton Cole challenges Hartlepool keeper Arran Lee-Barrett
But West Ham gradually got the home team's measure and began to make ominous inroads into their penalty area.
Hartlepool failed to deal with Jack Collison's surge and the ball broke fortuitously for Behrami who struck a low right-footer past Lee-Barrett's despairing dive. Hartlepool hardly had time to curse their misfortune before the referee multiplied it with his harsh penalty award.
The second half was almost academic, with the home side trying unsuccessfully to thwart the Hammers' intention to put the tie to bed.
Getting shirty: Julien Faubert and Hartlepool United's Joel Porter battle for possession
The closest Hartlepool came was when Robert Green did well to push a closerange header from Gary Liddle over the bar in the 63rd minute.
'It was the result we wanted and we achieved it in a very professional manner,' said Gianfranco Zola.
The West Ham boss claimed he did not see what happened for the penalty but added: 'I don't think it decided the game.' Hartlepool have beaten Stoke in the FA Cup and West Bromwich in the Carling Cup but West Ham were just too good.