Yes, my old 3GS did this also after the iOS4 update. It was fine on iOS3, but once upgraded it did it a lot. I took it back to apple for an exchange, it was a very common problem.
I did read somewhere that it was believed to be an issue where by iOS4 was using a temperature sensor on the battery, that iOS3 didn't ever use. This was causing a false reading of over temp and then shutting down the phone. There was a mega long thread on apples own support forum, but the company would never officially admit the fault - at least they hadn't up to the point that I had mine swapped, and i kind of had less interest in it after that!!