This is a common condition with this model due to a programming/logic issue with the computer. If the thermostat and sensor are working, you likely have the old flawed software.
Any Mazda dealer can perform the update reflash for you, typically for 1/2 hour labor (about $45), though individual dealer pricing can vary a bit.
I am attaching the details of the software update below; if the dealer doesn't know what you are talking about, you can print this out to take in with you as it has complete instructions.
MULTI-MODEL - MIL ILLUMINATION WITH DTC P0128 BULLETIN NOTE:
This bulletin supersedes the previous bulletin issued on 10/03/07. The APPLICABLE MODEL(S)/VINS has been revised. APPLICABLE MODEL(S)/VINS
2004-2005 Mazda3 vehicles
2006-2007 Mazda5 vehicles with VINs lower than JM1CR**** ** 160549 (produced before July 1, 2007)
Some vehicles may experience the MIL illumination with DTC P0128 (Coolant Thermostat Stuck Open) stored in memory without any problem on the ECT sensor and the IAT sensor. For example, this symptom may happen when driving after 1 to 1-1/2 minutes of idling with the heater and defroster ON after a cold start in cold conditions about 1°C (33-35°F). This condition may be caused by improper PCM calibration.
Customers having this concern should have their vehicle repaired using the following repair procedure.
|1. ||Reboot the PDS/IDS PTU to clear memory before reprogramming. |
|2. ||Using PDS/IDS 50.2 or later software, reprogram the PCM to the latest calibration (refer to Calibration Information table) by following the Module Reprogramming procedure. |
|^ ||Always update the PDS/IDS tool first, then follow on-screen instructions to download the needed calibration file for PCM reprogramming. |
|^ ||It is not necessary to remove any fuses or relays during PCM reprogramming when the PDS/IDS screen prompts you to do so. You may accidentally stop power to one of the PCM terminals and cause the PCM to be blanked, or you may receive error messages during the PDS/IDS reprogramming procedure. |
|^ ||PDS/IDS shows the calibration part numbers after programming the PCM. |
|^ ||Please be aware that PCM calibration part numbers and file names listed in any Service Bulletin may change due to future releases of PDS/IDS software, and additional revisions made to those calibrations for service related concerns. |
|^ ||When reprogramming a PCM, PDS/IDS will always display the latest calibration P/N available for that vehicle. If any calibration has been revised/updated to contain new information for a new service concern/issue, it will also contain all previously released calibrations. |
|^ ||When performing this procedure, we recommend that a battery charger be installed on the vehicle battery and turned ON to a maximum charge of no more than 20 AMPS to keep the vehicle battery up to capacity. If you exceed 20 AMPS, it could damage the VCM. |
|3. ||After performing the PCM reprogramming procedure, verify the repair by starting the engine and making sure there are no MIL illumination or abnormal warning lights present.|
|^ ||If any DTCs should remain after performing DTC erase, diagnose the DTCs according to the appropriate Troubleshooting section of the Workshop Manual. |
|^ ||After PCM reprogramming, it is no longer necessary to road test the vehicle to relearn KAM (Keep Alive Memory). |
|4. ||For Mazda3 vehicles built prior to February 1, 2004 (VIN: JM1BK ** 149352), perform the following additional work. Allow vehicle to cool down overnight. Drive vehicle and check if MIL (DTC P0128) comes ON. |
|^ ||If the MIL still comes ON with DTC P0128, replace thermostat with a modified part according to Workshop Manual (section 01-12 THERMOSTAT REMOVAL/INSTALLATION).|