The best estimates I have been able to give are by splitting the work into as many smaller tasks as possible. They should be small enough that you are very confident of the estimated time. A day's work is good for many people (ie, if any task is more than a day's work, split it). For some others, it's half-a-day.
If you do have really very uncertain things, give an estimate for how you can get more clarity, and then do the real estimate only once you get reasonable clarity. Alternatively, make an initial estimate (but make it explicit that it is rough), and re-estimate when you have more clarity. It's important to get the uncertain things out of the way first before doing real work.