I would speculate that in the case of a fire, the subsequent change in altitude was probably more likely the result of loss of control, or the autopilot was still connected and became confused by the avionics/instrumentation sending it bad/invalid data.
The latter part seems fairly unlikely, but I have no idea what a fire would do if it took out or disrupted the instrumentation, flight computers, etc..