A harmonic oscillator that evolves under the action of both a systematic time-dependent force and a random time-correlated force can do work w. This work is a random quantity, and Mai and Dhar have recently shown, using the generalized Langevin equation (GLE) for the oscillator's position x, that it satisfies a fluctuation theorem. In principle, the same result could have been derived from the Fokker-Planck equation (FPE) for the probability density function, P(x,w,t), for the oscillator being at x at time t, having done work w. Although the FPE equivalent to the above GLE is easily constructed and solved, one finds, unexpectedly, that its predictions for the mean and variance of w do not agree with the fluctuation theorem. We show that to resolve this contradiction, it is necessary to construct an FPE that includes the velocity of the oscillator, v, as an additional variable. The FPE for P(x,v,w,t) does indeed yield expressions for the mean and variance of w that agree with the fluctuation theorem. © 2008 IOP Publishing Ltd.