Crystal Palace moved off the foot of the Premier League table with a 1-0 victory over West Ham United at Selhurst Park.