Darwin's studies on heterostyly in Primula described two floral morphs, pin and thrum, with reciprocal anther and stigma heights that promote insect-mediated cross-pollination. This key innovation evolved independently in several angiosperm families. Subsequent studies on heterostyly in Primula contributed to the foundation of modern genetic theory and the neo-Darwinian synthesis. The established genetic model for Primula heterostyly involves a diallelic S locus comprising several genes, with rare recombination events that result in self-fertile homostyle flowers with anthers and stigma at the same height. Here we reveal the S locus supergene as a tightly linked cluster of thrum-specific genes that are absent in pins. We show that thrums are hemizygous not heterozygous for the S locus, which suggests that homostyles do not arise by recombination between S locus haplotypes as previously proposed. Duplication of a floral homeotic gene 51.7 million years (Myr) ago, followed by its neofunctionalization, created the current S locus assemblage which led to floral heteromorphy in Primula. Our findings provide new insights into the structure, function and evolution of this archetypal supergene.