Welcome to NICO. I hope you enjoy your stay here.
So many things can go wrong that prevent you from starting a warm engine. You may have a bad Engine Coolant Temp Sensor (ECTS), Crankshaft Position Sensor (CKPS), Air Inlet Temp (IAT) sensor, Throttle Position Sensor (TPS), etc. Fuel delivery may also be a problem such as leaking Fuel Pressure Regulator (FPR). Even a dying Ignition Switch could be a problem. I'm more inclined towards the Coolant Temp Sensor but there is no point replacing component w/o proper diagnostic.
Start with a simple one by having a free scan from Autozone and the likes and get a printout of trouble codes, if any. A trouble code may not necessarily turn on the CEL but is very helpful in diagnostic.
Next time you are having a starting problem, disconnect the MAF sensor and see if the car starts. If so, then you have a defective MAF sensor (cold solder or cracked board).
Check the battery connections for corrosion. Clean as required, verify tightness and check battery voltage is >12.5VDC with engine OFF. Check the entire air intake - air filter (replace if dirty), clean MAF sensor (with CRC MAF Sensor Cleaner @ $8 from AZ), and check all connections to air intake as well as vacuum lines. If problem persisted, other sensors may be involved or problem with fuel delivery such as a leaking Fuel Pressure Regulator. Refer to the link below for additional info.
http://www.nicoclub.com/FSM/maxima/2004/EC.pdf