West Ham manager Slaven Bilic was grateful to a slice of good fortune on his 48th birthday as Pedro Obiang's deflected opener helped lift the Hammers off the bottom of the Premier League.
Bilic was jeered by sections of his own supporters following the replacement of Hernandez for Andre Ayew, but it was the substitute who set up Obiang for his fortuitous strike which looped off Mathias Jorgensen and past the hapless Jonas Lossl.
Ayew then doubled West Ham's lead with 14 minutes remaining to send the hosts towards victory as he reacted fastest to a loose ball inside the six-yard box to poke a shot over the line and ease the pressure on Bilic.