(CNN) -- Substitute Zavon Hines scored an injury-time winner against 10-man Aston Villa to give West Ham a 2-1 victory, a result that lifts them out of the bottom three of the Premier League and prevents Villa from moving up to fourth place.
Hines fired home after a fine run by Scott Parker as the game looked to be heading for a draw.
Mark Noble had put the struggling home side in front from the penalty spot in first-half injury time after Habib Beye had brought down Hines in the area.
Villa wasted a golden chance to level in the 47th minute when Manuel Da Costa was adjudged to have fouled James Collins.
However, winger Ashley Young's penalty was superbly saved, diving down to his left, by England colleague Robert Green.
Young atoned for that miss with a 51st minute equalizer, curling home a superb shot into the top corner of the net.
Villa had Beye sent off in the 84th minute for a second bookable offence and the home side made their man advantage count in the final minute when Hines fired Parker's pass into the roof of the net.