Multi-component thermal fluid flooding is an increasingly mature technology for heavy oil recovery. However, the production of associated gas containing highly corrosive CO2/O2/SO2/H2S/H2O impurities can lead to corrosion and perforation failure in gathering pipelines. This study systematically investigated the effects of temperature/CO2/O2/SO2/H2S on L245NS steel corrosion in a CO2–O2–SO2–H2S–H2O environment and analyzed the correlation between these factors and corrosion rate. The corrosion behavior of L245NS steel in a CO2–O2–SO2–H2S–H2O environment was investigated through weight-loss experiments and surface characterization techniques. An empirical model for predicting the corrosion rate in this environment was established based on the obtained results. The results indicated that the sequence of importance for corrosion rate was as follows: O2 (0.8181) > H2S (0.7511) > Temperature (0.7491) > CO2 (0.7312) > SO2 (0.7017). Surface characterization revealed that the predominant corrosion products were FeCO3, FeS2, FeS, Fe(OH)3, FeOOH, Fe3O4, Fe2O3, elemental sulfur and FeSO4·4H2O. The corrosion reaction involved CO2/O2/SO2/H2S while synergistic reactions between SO2–O2 and SO2–H2S further promoted corrosion. Finally, an empirical model for the corrosion rate of L245NS steel in a CO2–O2–SO2–H2S–H2O environment was established. The fitting error ranged from 0.03% to 8.99%, and the verification error ranged from 2.62% to 14.83%. This model can provide a valuable reference for preventing and controlling pipeline corrosion.