  We discuss dephasing times for a two-level system (including bias) coupled to
a damped harmonic oscillator. This system is realized in measurements on
solid-state Josephson qubits. It can be mapped to a spin-boson model with a
spectral function with an approximately Lorentzian resonance. We diagonalize
the model by means of infinitesimal unitary transformations (flow equations),
and calculate correlation functions, dephasing rates, and qubit quality
factors. We find that these depend strongly on the environmental resonance
frequency $\Omega$; in particular, quality factors can be enhanced
significantly by tuning $\Omega$ to lie below the qubit frequency $\Delta$.
