Notts County striker Mark Stallard burst Premiership West Ham's bubble with a superb headed winner.
Stallard flung himself full length to nod home just after the half hour and give the Second Division team a deserved victory.
Danny Allsopp scored at the second attempt on three minutes after David James could only parry his first effort.
Adam Newton equalised but Stallard had the final word.