Hmmm, thread drift, but here we go...
In perfect theory, fire requires three things in adequate proportion: Fuel, heat, and oxygen. Take any one away, and the fire is supposed to extunguish (or at least become much less intense). Hence, the design requirement that the pilot be able to turn things off.
Firewall cutoff selected, the fuel is no longer supplied to an engine fire. Aside from the gasoline, which you have now turned off, there's not supposed to ba any other exposed fuel up there. Master off, the heat is no longer supplied to an electrical fire.
I know that this is the ideal world of aircraft existance, and nasty fires still do happen, but it's a risk so low on my list of things to worry about, that I take no other precautions than simply being aware of how the aircraft systems are to be used in such an event.