Hello and welcome to Just answer.com, Super mechanic here. About your vehicle.
There may be a problem with the idle air control circuit but you will want to make sure that the throttle body and idle air passages are clean.
You may want to do a throttle body cleaning on it. You can pick up some throttle body cleaner in most any part stores. You can follow the directions on the can but you will want to make sure that you give it a few shots with the throttle plate closed, so that the cleaner can get into the idle air passages.
Of course, you will want to make sure there are no vacuum leaks and that there is not any un-metered air that is entering into the intake, and that the air intake hose is on good and free of any cracks, thanks
DEFECT: On certain sport utility vehicles equipped with 3.0L V6 Duratec engines, during deceleration at vehicle speeds below 40 mph, the engine may stall, possibly resulting in a vehicle crash.
REMEDY: Dealers will reprogram the Powertrain Control Module. The manufacturer has reported that owner notification began on May 3, 2004. Owners may contact Mazda at 1-800-222-5500.