"Actually this happened to my iPhone 3GS last month! I don’t know why it did that, and it ended up fixing itself, later that day. You can turn it off by holding both the Home button and the sleep/wake button at the same time. This will cause it to restart, but keep holding it PAST that and eventually it will plain old turn off. Later, you can tap Sleep/Wake to wake it back up. I did this a bunch of times and it woke up. Not much of an answer, but at least you can turn it off while its sick."
- Mike O'Connor