The ultrasonic method has been widely applied to measure the oil film thickness – a critical variable that reflects lubrication conditions. However, due to the thermal dependence of ultrasonic signals, significant deviations in film thickness measurements are introduced, hindering the in-situ application of the ultrasonic technique. To address this issue, a real-time temperature compensation method that can accurately obtain the frequency domain information of the reference signal is proposed. Specifically, the reflection from the substrate-coating interface compensates for the thermal effect on the phase increment and amplitude attenuation – this is noted as “self-calibration”. An extra experimental test with a substrate-coating-air structure is performed to calibrate the thermal effect on the coating-induced phase shift – this part is denoted as “pre-calibration”. The combination of “self-calibration” and “pre-calibration” enables the overall temperature compensation strategy. After the effectiveness validation with a temperature-controlled experiment, the proposed method is implemented in a thrust bearing in a heavy-duty hydropower generator with full running conditions, including loading and unloading, normal speed and shut-down. The largely ranged oil film thickness (3–330 μm) is ultrasonically measured and compared with the theoretical value, showing a higher measurement accuracy than the eddy current method.