The thermodynamics of a qubit undergoing dephasing due to the coupling with the external environment is discussed. First of all, we assume the dynamics of the system to be described by a master equation in Lindblad form. In this framework, we review a standard formulation of the first and second law of thermodynamics that has been known in literature for a long time. After that, we explicitly model the environment with a set of quantum harmonic oscillators choosing the interaction such that the global dynamics of system and bath is analytically solvable and the Lindblad master equation is recovered in the weak-coupling limit. In this generalized setting, we can show that the correlations between system and bath play a fundamental role in the heat exchange. Moreover, the internal entropy production of the qubit is proven to be positive for arbitrary coupling strength.