iPhone 3G
This is a very unusual problem, one i have never encountered before. You can try the most obvious of fixes, for example..
Plug your iPhone into its charger and turn it off, insert the sim card while it is still off and turn it on after you have placed the sim card in. Keep your iPhone plugged in during the entire process.
If this doesn't work, try restoring your iPhone whilst the sim card is out, make backups of any files you may have on your iPhone and try again after restoration.
Hope this helped!