  We undertake a thorough analysis of the thermodynamics of the trajectories
followed by a quantum harmonic oscillator coupled to $N$ dissipative baths by
using a new approach to large-deviation theory inspired by phase-space quantum
optics. As an illustrative example, we study the archetypal case of a harmonic
oscillator coupled to two thermal baths, allowing for a comparison with the
analogous classical result. In the low-temperature limit, we find a significant
quantum suppression in the rate of work exchanged between the system and each
bath. We further show how the presented method is capable of giving analytical
results even for the case of a driven harmonic oscillator. Based on that
result, we analyse the laser cooling of the motion of a trapped ion or
optomechanical system, illustrating how the emission statistics can be
controllably altered by the driving force.
