Generalist predators whose primary prey undergoes cyclic fluctuations, will predate on alternate food sources when the abundance of their primary prey is low. In this paper we have developed a general model of a predator that switches predation between its primary prey and two alternative, competing, prey species. When the predators primary prey is at high abundance, predation of the alternate, competing, prey species is low, which provides periods of temporal refuge for the alternate prey from predation. When the inter‐specific interactions between the competing prey species lead to different dynamical outcomes in the presence and absence of predation, increasing the duration of the temporal refuge promotes dominance of a competitively superior species that is vulnerable to predation. The general theoretical framework was extended to consider a key case study system of pine marten predation on red and grey squirrels. In the absence of predation, grey squirrels out‐compete red squirrels but preferential predation by pine marten on grey squirrels can suppress grey squirrel density and allow red squirrel recovery. A temporal refuge for both squirrel species can arise due to prey switching by pine marten in years when field voles, their primary prey in the UK, are abundant. The duration of the temporal refuge, quantified as the relative length of the multi‐annual vole population cycle where vole density is above a population threshold, is a critical factor determining the persistence of red and grey squirrels. Our findings therefore provide insights for the conservation of the endangered red squirrel in the UK and the Republic of Ireland and more generally on the influence of the population dynamics of primary prey species in determining community composition.