I disagree with James' answer. The earning would be subject to income tax becasue the money was not in the Roth at least five years BUT not the 10% penalty. The rule he was citing relates to getting the earnings tax free in this situation.
Code Section 72(t) applies to avoid the 10% penalty on the earnings if all of the other rules related to a first time home buyer exception are met, such as you or your spouse has not owned a house for two years prior to purchasing the home.
Paul Leslie, EA
http://www.taxesbypaul.com