I don't understand why you wouldn't say that you knew what codes you had when you made your post. If you have a tool to read the codes do you also have the freeze frame from when the code was set?
every time you reset the computer it goes through a relearn procedure. As soon as the monitors are reset the computer will see the problem that you erased before and will go into limp mode all over again. You have to address the codes not just erase them.
P0316: misfire during the first 1000 rpms after start up.
P2197: excessive time between O2 sensor switching or no O2 sensor switching since start up indicates a problem. (always indicates too lean)
things to look at are the ECT, CHT, IAT, MAF, and CKP sensors
that are the input for the HO2S monitor. and the CMP and CKP for misfires. Look at the O2 sensors, the fuel trims and see if there is a vacuum leak. Cylinders running too lean will cause a misfire.
What engine does your mustang have? I have had some v6 mustangs that the harmonic balancer bolt has come loose and the balancer moves causing the crank sensor to see the crank shift making it fire at the wrong time.Sensors
in the MAF can get coated with debris that get through the air filter and insulate the sensors making them so they will read lean. Then the engine see less air coming in and give the engine less fuel.
you should also look at mode 6 data. Look for cylinder misfires. there is so much information you can access with a scanner.
You can attach a fuel pressure gauge to the fuel rail and watch what the readings are when you are experiencing the problem. Fuel pressure should be 23-37psi engine running. but if the fuel pressure was the problem why would it only hesitate and then take off? you would think that if it was a fuel pump issue that it would bog and not accelerate because you run out of fuel. But stranger things do happen.