Herbivorous insects are extraordinarily diverse, yet are found in only one-third of insect orders. This skew may result from barriers to plant colonization, coupled with phylogenetic constraint on plant-colonizing adaptations. The plant-penetrating ovipositor, however, is one trait that surmounts host plant physical defences and may be evolutionarily labile. Ovipositors densely lined with hard bristles have evolved repeatedly in herbivorous lineages, including within the Drosophilidae. However, the evolution and genetic basis of this innovation has not been well studied. Here, we focused on the evolution of this trait in
Scaptomyza
, a genus sister to Hawaiian
Drosophila
, that contains a herbivorous clade. Our phylogenetic approach revealed that ovipositor bristle number increased as herbivory evolved in the
Scaptomyza
lineage. Through a genome-wide association study, we then dissected the genomic architecture of variation in ovipositor bristle number within
S. flava
. Top-associated variants were enriched for transcriptional repressors, and the strongest associations included genes contributing to peripheral nervous system development. Individual genotyping supported the association at a variant upstream of
Gαi
, a neural development gene, contributing to a gain of 0.58 bristles/major allele. These results suggest that regulatory variation involving conserved developmental genes contributes to this key morphological trait involved in plant colonization.