We address the dephasing dynamics of a qubit as an effective process to estimate the temperature of its environment. Our scheme is inherently quantum, since it exploits the sensitivity of the qubit to decoherence, and does not require thermalization with the system under investigation. We optimize the quantum Fisher information with respect to the interaction time and the temperature in the case of Ohmic-like environments. We also find explicitly the qubit measurement achieving the quantum Cramer- Rao bound to precision. Our results show that the conditions for optimal estimation originate from a non-trivial interplay between the dephasing dynamics and the Ohmic structure of the environment. In general, optimal estimation is achieved neither when the qubit approaches the stationary state, nor for full dephasing.