Using an ATX PSU, how would I design a circuit to power a load (dc fan) with 5v standby when PSU is off, and with 12v when PSU is on. I want to control (on/off or pwm, it should not matter?) the fan from a 3.3v mcu (powered with standby 5v) using a single pin. I guess it will require at least 2 P-mosfets, resistors on gates side and flyback diode across fan, but can't find how to do it cleverly without extra "logic" on both gates sides.
A diode from 12V and a diode from 5V standby to the fan provides powering you require.
Then PWM as desired (single FET or transistor plus diode across the fan).
Note that you CANNOT with certainty reliably speed control a brushless DC motor this way.
No, that was not a typo - 'with certainty' and 'reliably' both belong.
Note that most small fans that you will encounter will use brushless DC motors (BLDC motors).
If a BLDC motor controller is designed to operate it at the max speed that it will run at on a given voltage
AND IF it will run on say 4.5V to 12V
AND IF your PWM is arranged to supply a DC voltage that is ripple free enough not to aggravate the controller, then it will probably work OK.
If any of these is not true then it may work badly in some ranges or not at all.