The fine-structure line of [OI] at 63micron is an important diagnostic tool in different fields of astrophysics. However, our knowledge of this line relies on observations with low spectral resolution, and the real contribution of each component (PDR, jet) in complex environment of star-forming regions (SFRs) is poorly understood. We investigate the contribution of jet and PDR emission, and of absorption to the [OI]63micron line towards the ultra-compact H{sc ii} region G5.89--0.39 and study its far-IR line luminosity in different velocity regimes through [OI], [CII], CO, OH, and H2O. We mapped G5.89--0.39 in [OI] and in CO(16--15) with the GREAT receiver onboard SOFIA. We observed the central position of the source in the OH^2Pi_{3/2}, J=5/2toJ=3/2 and ^2Pi_{1/2}, J=3/2toJ=1/2 lines. These data were complemented with APEX CO(6-5) and CO(7-6) and HIFI maps and single-pointing observations in [CII], H2O, and HF. The [OI] spectra in G5.89--0.39 are severely contaminated by absorptions from the envelope and from different clouds along the line of sight. Emission is detected only at HV, clearly associated with the compact north-south outflows traced by extremely HV low-J CO. The mass-loss rate and energetics of derived from [OI] agree well with estimates from CO, suggesting that the molecular outflows in G5.89--0.39 are driven by the jet system seen in [OI]. The far-IR line luminosity of G5.89--0.39 is dominated by [OI] at HV; the second coolant in this velocity regime is CO, while [CII], OH and H2O are minor contributors to the cooling in the outflow. Our study shows the importance of spectroscopically resolved data of [OI]63micron for using this line as diagnostic of SFRs. While this was not possible until now, the GREAT receiver onboard SOFIA has recently opened the possibility of detailed studies of this line to investigate its potential for probing different environments.