  Quantitative helio- and asteroseismology require very precise measurements of
the frequencies, amplitudes, and lifetimes of the global modes of stellar
oscillation. It is common knowledge that the precision of these measurements
depends on the total length (T), quality, and completeness of the observations.
Except in a few simple cases, the effect of gaps in the data on measurement
precision is poorly understood, in particular in Fourier space where the
convolution of the observable with the observation window introduces
correlations between different frequencies. Here we describe and implement a
rather general method to retrieve maximum likelihood estimates of the
oscillation parameters, taking into account the proper statistics of the
observations. Our fitting method applies in complex Fourier space and exploits
the phase information. We consider both solar-like stochastic oscillations and
long-lived harmonic oscillations, plus random noise. Using numerical
simulations, we demonstrate the existence of cases for which our improved
fitting method is less biased and has a greater precision than when the
frequency correlations are ignored. This is especially true of low
signal-to-noise solar-like oscillations. For example, we discuss a case where
the precision on the mode frequency estimate is increased by a factor of five,
for a duty cycle of 15%. In the case of long-lived sinusoidal oscillations, a
proper treatment of the frequency correlations does not provide any significant
improvement; nevertheless we confirm that the mode frequency can be measured
from gapped data at a much better precision than the 1/T Rayleigh resolution.
