Yes, you can also fix a peak (or a low) in between two discontinuous data sets using the same method: The 'state' will still show the values from the both data sets, the 'sum' however can be fixed to continue the series over the both sets. In fact, I once imported my energy readings from the time I used Domoticz before I used Home Assistant into the statistics table (in the homeassistant db) with timestamps before I had HA running. I had to fix a single entry in both the consumption and the production statistics and from then on I could see my old Domoticz data in HA's dashboard, combined with the values recorded by HA.
It isn't completely flawless though, because Domoticz only stores its energy information on a daily basis. My pre-HA energy data thus shows as one single 'measurement' each day. But hey, I don't care, because I realistically never need to see my usage per hour from over a year in the past... Most of the times I only use that old data to compare monthly or even yearly usage/production.