Recently my wife's iPhone screen cracked and we have been looking into ways to get it replaced. I found this video on YouTube that is very helpful in describing how to replace a cracked iPhone screen, but it shows me that it would be a better idea to take it back to Apple since this looks very difficult and would void the warranty. Here is the video for your reference though if you think you can do a repair like this:
iPhone Screen Replacement
iPhone 3GS Screen Replacement
Update: If you are looking for parts to fix your iPhone screen then a good site to check out is iFixit. This site has a lot of parts for the iPhone as well as other Apple products. Sometimes it is cheaper to get the parts elsewhere, but iFixit has great tutorials for completing these DIY projects so it is worth checking out even if you decide the part could be found cheaper somewhere else.