Hello @tusi,
I have the same problem as you do.
I am using HA’s default SQlite DB and after some HA core upgrade and restart my long-term HVAC stat changed from 29 to 473066 (heating TOTAL ON in hrs).
Basically my graph now looks exactly the same as yours in your post here: After rebooting Home Assistant, history gets corrupted - #7 by tusi
How did you change the data, how did you know how? I started SQLite Web add-in to browse the data but I do not know what rows to update/insert or delete. Where did you learn the data structure please?