The problem with this approach is stuns or other pausing effects.
1. you get stunned
2. you order fearie fire on, but it will only happen after the stun. However the variable is set to true.
3. you order stop, to overwrite the last order
4. stun expires, unit uses "stop", but not "faeriefireon". The variable is set to true, but autocast is off.
You can use the fact, that order functions return whether they are succesful.
If you order a unit to "feariefireon" and it is succesful, you know that the unit previously had faerie fire deactivated.
If you combine HappyTauren's method with this idea, it will also work, if the unit is paused.