Could also be a bad battery connection, ground and anything of the like. Also, a bad MLP Sensor (range sensor) will do this as well.
Did your overdrive light flash during the bad shifting episode? If so, then I would bet on the sensor, if not and the troubles return, start checking all your connections as listed above. Also, be sure to check all connections for signs that water might have made it into the connector.