classic problem, shattered front piece of glass on 3gs. the replacement is cheap and the fix is pretty easy on this model. note that on newer models (iphone 4, 4s) this may not be the case since the glass is fused to the display.
this is the second time I've replaced the glass on my 3gs in about a year, so I didn't have to look at the repair manual. pretty easy.
watch the video and follow the guide. get a few shot glasses for the screws to keep them separated and in a safe place while you work. be careful when pulling the front and back apart and avoid damaging the ribbon cables. flat end of metal spudger is the way to go on a lot of the steps - use it to pry between front bezel when taking front and back apart and also to pop out the ribbon cable connectors. be gentle with the ribbon cables.