London - Aaron Cresswell's first goal for West Ham was enough to bring Newcastle's six-match winning run in all competitions to an end with a 1-0 win at Upton Park on Saturday.
Cresswell collected Cheikhou Kouyate's pass in the area on 55 minutes and fired the ball low into the bottom right hand corner with visiting goalkeeper Rob Elliott beaten.
Newcastle, with a patched-up defence and a string of injuries to key players, almost hit back immediately when Perez's shot from the right side of the box was saved in the bottom left corner.
Despite having the greater share of possession, Newcastle's cause was dealt a killer blow when in-form Moussa Sissoko was sent off a quarter-of-an-hour from the end for a second booking inside 40 seconds. The second was for a bad foul on former Magpies striker Andy Carroll after he had kicked the ball away in disgust for his first yellow card.
Even then, Stewart Downing and Carroll had chances to put it beyond Newcastle's reach at the death, but both hit their shots wide.
The winning streak had taken Alan Pardew's men from 18th into the top six, but the Hammers made sure there was no happy return to east London for the manager who took them to within seconds of FA Cup final glory against Liverpool at Wembley in 2006.
There was revenge in the air, though, for Allardyce, who was dismissed by Newcastle six years ago after a poor run of results and fan protests at the style of football his team were playing.
West Ham, whose home form had already seen them beat Liverpool and champions Manchester City at the Boleyn Ground, are now fifth, but Newcastle slipped back to eighth.
A cagey opening had brought an early booking for Newcastle's Michael Williamson on 18 minutes for a bad foul on Matthew Jarvis on the left wing, but saw a flurry of chances towards the end of the half.
Newcastle's Ayoze Perez was first to go close on 37 minutes when his shot from an awkward angle from Sammy Ameobi's cross was wide of the mark.
Then Ameobi tried his luck from outside the area, latching on to a ball from Sissoko, but his shot flashed wide.
West Ham's first real attempt came from Carroll as he took Downing's cross from the left and saw his shot blocked.