Environmental variation is commonplace, but unpredictable. Populations that encounter a deleterious environment can sometimes avoid extinction by rapid evolutionary adaptation. Phenotypic plasticity, whereby a single genotype can express multiple different phenotypes, might play an important role in rescuing such populations from extinction. This type of evolutionary bet-hedging need not confer a direct benefit to a single individual, but it may increase the chance of long-term survival of a lineage. Here we develop a population-genetic model to explore how partly heritable phenotypic variability influences the probability of evolutionary rescue and the mean duration of population persistence, in changing environments. We find that the probability of population persistence depends non-monotonically on the degree of phenotypic heritability between generations: some heritability can help avert extinction, but too much heritability removes any benefit of phenotypic plasticity. We discuss the implications of these results in the context of therapies designed to eradicate populations of pathogens or aberrant cellular lineages.