The genomics of local adaptation is an increasingly active field, providing insights into the forces driving ecological speciation and the repeatability of evolution. Demography and gene flow play an important role in determining the paths by which parallel evolution occurs and the genomic signatures of adaptation. In the annual sunflowers, hybridization between species has repeatedly led to the colonization of extreme habitats, such as sand dunes. In a new case of adaptation to sand dunes that occurs in populations of H. petiolaris growing at Great Sand Dunes National Park and Preserve (Colorado), we wished to determine the age and long-term migration patterns of the system, as well as its ancestry. We addressed these questions with restriction-associated DNA (RAD) sequence data, aligned to a reference transcriptome. In an isolation with migration model using RAD sequences, coalescent analysis showed that the dune ecotype originated since the last ice age, which is very recent compared with the hybrid dune species, H. anomalus. Large effective population sizes and substantial numbers of gene migrants per generation between dune and nondune ecotypes explained the highly heterogeneous divergence observed among loci. Analysis of RAD-derived SNPs identified heterogeneous divergence between the dune and nondune ecotypes, as well as identifying its nearest relative. Our results did not support the hypothesis that the dune ecotype has hybrid ancestry, suggesting that adaptation of sunflowers to dunes has occurred by multiple mechanisms. The ancestry and long-term history of gene flow between incipient sunflower species provides valuable context for our understanding of ecological speciation and parallel adaptation.