Realistic assessments of the impacts of global warming on population extinction risk are likely to require an integrated analysis of the roles of standing genetic variation, microhabitat thermal complexity, and the inter-individual variation of heat tolerance due to both genetic differences and seasonal acclimatization effects. Here, we examine whether balancing selection and microhabitat temperature heterogeneity can interact to enhance the population persistence to thermal stress for the black mussel Septifer virgatus. We deployed biomimetic data loggers on the shore to measure the microhabitat-specific thermal variation from June 2014 to April 2016. Thermal tolerance of specimens was indexed by measuring effects of temperature on heart rate. Genotyping of specimens was performed using double digestion restriction association RADSeq (ddRADseq). Our results show that inter-individual variations in thermal tolerance correlate significantly with genetic differences at some specific gene loci, and that heterozygotes have higher thermal tolerances than homozygotes. The observed seasonal changes in genotype frequency suggest that these loci are under balancing selection. The ability of thermally resistant heterozygotes to survive in sun-exposed microhabitats acts to balance the loss of homozygotes during summer and enable the persistence of genetic polymorphisms. Population persistence of the mussel is also facilitated by the micro-scale variation in temperature, which provides refugia from thermal stress. Our results emphasize that inter-individual variation in thermal tolerance and in microhabitat heterogeneity in temperature are important for the persistence of populations in rocky shore habitats.