I decided to erase the contents of my iPhone by going to Settings > General > Reset > Erase All Contents and Settings. Unfortunately, my power cable was loose and it lost power in the middle of the erasing. After that, I tried hard resetting (holding down Home button and pressing the power key for 10 seconds), but it would only display the Apple logo, followed by a black screen. This happened repeatedly when I tried powering it on multiple times and hard resetting multiple times.
So, I called iPhone tech support and they suggested that I hold down the power button and plug it in to the USB so that iTunes could restore the iPhone. That forced me to upgrade to 3.1 software, but did indeed restore my iPhone. The iPhone was back to its factory default state and upgraded to 3.1