Resetting of epigenetic marks, such as DNA methylation, in germ cells or early embryos is not always complete. Epigenetic states may therefore persist, decay or accumulate across generations. In spite of mounting empirical evidence for incomplete resetting, it is currently poorly understood whether it simply reflects stochastic noise or plays an adaptive role in phenotype determination. Here, we use a simple model to show that incomplete resetting can be adaptive in heterogeneous environments. Transmission of acquired epigenetic states prevents mismatched phenotypes when the environment changes infrequently relative to generation time and when maternal and environmental cues are unreliable. We discuss how these results may help to interpret the emerging data on transgenerational epigenetic inheritance in plants and animals.