I use the following rules when I try to estimate developping time :
No serious estimation without complete specs
Don't assume that when you do several times the same thing you'll do it faster (In fact you'll probably get bored and it will balance the speed gained by experience)
No real task should be made professionnaly in less than half a day (Real analysis,Test, Documentation...Not only implementation)
Try to estimate the time to do each small task, sum up, then multiply by 2
(test, client interaction, integration...)
If I don't have total control I can't produce correct estimation
(state it but try to give an estimation anyway :
"Provided the ISP had mod_perl properly configured it will take X hours, add X hours if I have to only use PHP...")
Any addition to the specs will change the estimation (even if they take something out, beccause your prior analysis and possibly data structure may be now inadequate...)
Following those guidelines have saved me several time.
"Only Bad Coders Code Badly In Perl" (OBC2BIP)