Hammers set for relegation as QPR beat the drop