Gene regulatory networks allow organisms to generate coordinated responses to environmental challenges. In bacteria, regulatory networks are re-wired and re-purposed during evolution, though the relationship between selection pressures and evolutionary change is poorly understood. In this study, we discover that early evolutionary response of Escherichia coli to the antibiotic trimethoprim involves de-repression of PhoPQ signalling, a Mg2+-sensitive two-component system, by inactivation of the MgrB feedback-regulatory protein. We report that de-repression of PhoPQ confers trimethoprim-tolerance to E. coli by hitherto unrecognized transcriptional up-regulation of dihydrofolate reductase (DHFR), target of trimethoprim. As a result, mutations in mgrB precede and facilitate the evolution of drug resistance. Using laboratory evolution, genome sequencing and mutation re-construction, we show that populations of E. coli challenged with trimethoprim are faced with the evolutionary "choice" of transitioning from tolerant to resistant by mutations in DHFR, or compensating for the fitness costs of PhoPQ de-repression by inactivating the RpoS sigma factor, itself a PhoPQ-target. Outcomes at this evolutionary branch-point are determined by strength of antibiotic selection, such that high pressures favour resistance, while low pressures favour cost-compensation. Our results relate evolutionary changes in bacterial gene regulatory networks to strength of selection and provide mechanistic evidence to substantiate this link.