Context. Radiation-driven mass loss is key to our understanding of massive-star evolution. However, for low-luminosity O-type stars there are big discrepancies between theoretically predicted and empirically derived mass-loss rates (called the weak-wind problem). Aims. We compute radiation-line-driven wind models of a typical weak-wind star to determine its temperature structure and the corresponding impact on ultra-violet (UV) line formation. Methods. We carried out hydrodynamic simulations of the line-deshadowing instability (LDI) for a weak-wind star in the Galaxy. Subsequently, we used this LDI model as input in a short-characteristics radiative transfer code to compute synthetic UV line profiles. Results. We find that the line-driven weak wind is significantly shock heated to high temperatures and is unable to cool down effciently. This results in a complex temperature structure where more than half of the wind volume has temperatures significantly higher than the stellar effective temperature. Therefore, a substantial portion of the weak wind will be more ionised, resulting in a reduction of the UV line opacity and therefore in weaker line profiles for a given mass-loss rate. Quantifying this, we find that weak-wind mass-loss rates derived from unsaturated UV lines could be underestimated by a factor of between 10 and 100 if the high-temperature gas is not properly taken into account in the spectroscopic analysis. This offers a tentative basic explanation for the weak-wind problem: line-driven weak winds are not really weaker than theoretically expected, but rather a large portion of their wind volume is much hotter than the stellar effective temperature.