The cost of inbreeding (inbreeding depression, ID) is an important variable in the maintenance of reproductive variation. Ecological interactions such as herbivory could modulate this cost, provided that defence traits harbour deleterious mutations and herbivores are responsible for differences in fitness. In the field, we manipulated the presence of herbivores on experimentally inbred and outcrossed plants of Solanum carolinense (horsenettle) for three years. Damage was greater on inbred plants, and ID for growth and fitness was significantly greater under herbivory. Inbreeding reduced phenolic expression both qualitatively (phytochemical diversity) and quantitatively, indicating deleterious load at loci related to the biosynthesis of defence compounds. Our results indicate that inbreeding effects on plant–herbivore interactions are mediated by changes to functional plant metabolites, suggesting that variation in inbreeding could be a predictor of defence trait variation. The magnitude of herbivore-mediated, ecological ID indicates that herbivores could maintain outcrossing mating systems in nature.