Global climate change is causing extreme heating events and intensifying infectious disease outbreaks. We tested whether warming (at various host life stages) could shape the ecological and evolutionary trajectory of host resistance, by competing nematode host genotypes across 10 generations during infection by a natural bacterial pathogen. We found that persistent warming throughout host development and during infection strongly favoured genetic-based host resistance. Ambient temperatures or periodic warming within host lifetime resulted in the loss of genetic-based resistance, despite pathogen presence. Warming during host development caused plastic temperature-mediated protection which weakened selection for more costly resistance. The findings of an associated mechanistic model suggest that dilution of pathogen cells by resistant hosts might help protect susceptible individuals when warming does not occur during development. Host evolutionary trajectories were likely driven by the combination of fitness constraints on genetic-based resistance, host plasticity, condition-dependent pathogen virulence, and dilution effects.