Carbon dioxide (CO(2)) elicits an attractive host-seeking response from 
mosquitos yet is innately aversive to Drosophila melanogaster despite being a 
plentiful byproduct of attractive fermenting food sources. Prior studies used 
walking flies exclusively, yet adults track distant food sources on the wing. 
Here we show that a fly tethered within a magnetic field allowing free rotation 
about the yaw axis actively seeks a narrow CO(2) plume during flight. Genetic 
disruption of the canonical CO(2)-sensing olfactory neurons does not alter 
in-flight attraction to CO(2); however, antennal ablation and genetic disruption 
of the Ir64a acid sensor do. Surprisingly, mutation of the obligate olfactory 
coreceptor (Orco) does not abolish CO(2) aversion during walking yet eliminates 
CO(2) tracking in flight. The biogenic amine octopamine regulates critical 
physiological processes during flight, and blocking synaptic output from 
octopamine neurons inverts the valence assigned to CO(2) and elicits an aversive 
response in flight. Combined, our results suggest that a novel Orco-mediated 
olfactory pathway that gains sensitivity to CO(2) in flight via changes in 
octopamine levels, along with Ir64a, quickly switches the valence of a key 
environmental stimulus in a behavioral-state-dependent manner.