Boolean and millis: doing it wrong?

lastLEDtime is only ever updated when you turn the fan off, so when you hit the button during the intermediate stages, millis() - lastLEDtime is continually ticking. That means the if statement to turn the fan off will only work if the intermediate stages occur within the 5 seconds. You can get rid of the fanOn variable entirely. Instead, check if the analogWrite value for the LED is equal to 0 and it's been over 5 seconds since you turned the LED off.