Sounds like you may have found the source of the problem.
Mechanical timing is one thing that stays fairly fix but electronic timing can vary form cold to hot to too hot.
One comment here related to ignition coil packs. I have had the electronic control versions do some very unexpected firing related issues. I have seen them to fail completely, fail shortly after start-up, fail only after running 30 minutes, then engine was shut down and restart attempted 10 minutes. I even have a couple chainsaws that would randomly blow the air filters completely off due to random backfires through the carburetors.
I even had one Kawasaki engine nearly set my pants leg on fire because the ignitor was randomly misfiring the coil pack and would ignite the fuel mix on the exhaust stroke. Of course this one was a 4 cycle. The first time it did it while I working on the problem I thought someone discharged a shotgun behind me, not a good feeling at all.
So yes the ignition timing can be off only when hot if the coil pack is borderline bad. Even a partially sheared flywheel key can cause the same problem depending how much timing advance is built-in the coil's electronics as heat can causing the advance to shift slightly too much.