Biological invasions have caused the loss of freshwater biodiversity worldwide. The interplay between adaptive responses and demographic characteristics of populations impacted by invasions is expected to be important for their resilience, but the interaction between these factors is poorly understood. The freshwater gastropod Amnicola limosus is native to the Upper St. Lawrence River and distributed along a water calcium concentration gradient within which high-calcium habitats are impacted by an invasive predator fish (Neogobius melanostomus, round goby), whereas low-calcium habitats provide refuges for the gastropods from the invasive predator. Our objectives were to (1) test for adaptation of A. limosus to the invasive predator and the low-calcium habitats, and (2) investigate if migrant gastropods could move from refuge populations to declining invaded populations (i.e., demographic rescue), which could also help maintain genetic diversity through gene flow (i.e., genetic rescue). We conducted a laboratory reciprocal transplant of wild F0 A. limosus sourced from the two habitat types (high calcium/invaded and low calcium/refuge) to measure adult survival and fecundity in home and transplant treatments of water calcium concentration (low/high) and round goby cue (present/absent). We then applied pooled whole-genome sequencing of 12 gastropod populations from across the calcium/invasion gradient. We identified patterns of life-history traits and genetic differentiation across the habitats that are consistent with local adaptation to low-calcium concentrations in refuge populations and to round goby predation in invaded populations. We also detected restricted gene flow from the low-calcium refugia towards high-calcium invaded populations, implying that the potential for demographic and genetic rescue is limited by natural dispersal. Our study highlights the importance of considering the potentially conflicting effects of local adaptation and gene flow for the resilience of populations coping with invasive predators.