Forest regeneration can mitigate the negative effects of forest loss on species diversity, but less is known about how secondary and primary forests might differ in their ability to maintain genetic diversity. We quantified variation in genetic diversity of a hummingbird-pollinated, understory herb, Heliconia tortuosa, in Costa Rica across a landscape mosaic. Heliconia populations were more inbred in secondary forests where generalist hummingbird pollinators were more common. The amount of primary forest surrounding a given Heliconia population and the proportion of specialized hummingbird pollinators in that forest were correlated with lower inbreeding. Specialist pollinators likely increase mating among unrelated plants and therefore maintain genetic diversity, an inference we validated using empirically parameterized simulations. Thus, functionally disrupted pollination networks in secondary forests can reduce plant genetic diversity, even for a species as abundant as Heliconia, highlighting the value of primary forests for the maintenance of mutualistic networks and genetic diversity.