A train derailment Monday morning led to an outage affecting more than 17,000 Pacific Gas & Electric Co. customers in Stockton at the height of the outages.