Polygalacturonase inhibitor proteins (PGIPs) protect plants against invasion by diverse microbial and invertebrate enemies that use polygalacturonase (PG) to breach the plant cell wall. Directed mutagenesis has identified specific natural mutations conferring novel defensive capability in green bean PGIP against a specific fungal PG. These same sites are identified as positively selected by phylogenetic codon-substitution models, demonstrating the utility of such models for connecting retrospective comparative analyses with contemporary, ecologically relevant variation.