As stated so eloquently by Bob Lewis in his book "IS Survival Guide", There is no way for you to successfully estimate projects. Take that as a given. It can't be done, and for a very simple reason: Every one of your projects is one-of-a-kind. Mr. Lewis makes a very good point, however in my experience, I have yet to have met a manager that will let me get away with saying "I can't estimate this project".
SO WHAT IS A PROJECT MANAGER TO DO?
I like to call the solution to this problem rolling-wave estimating. By that I mean when the project is in the initiation phase and you have very little information your estimate should reflect that fact. This means very early in the project your estimate(s) could be off by as much as +200/-75% (or more). As you progress through the project planning phase you will breakdown the project into smaller, more manageable pieces of work (decomposition). This process helps to narrow the range of your estimates.
Do not be fooled into thinking that because you have broken down your project into phases and/or small manageable pieces of work that you can just add up the estimates and have a total overall project estimate. Many times, especially on IT projects, there are integration issues that are difficult to estimate and are usually ignored in the planning phase. Do not forget to add time for these critical integration activities. Also, while padding of estimates is a no-no, don't forget to account for Risk in your project estimates. PMI advocates for contingency and management reserves to account for risk events, but I have not worked in an environment where these exist so I have to plan for Risk in my estimates.
Be smart when estimating and realize that in the IT world estimates are always wrong and tasks are always underestimated.