If you are *certain* you'll be selling the house in 5 years or less, and you have adequate liquidity, I don't see a problem with this. It's probably not optimal, but if you're not comfortable with stock market volatility, it's certainly better than sitting in cash, which is pretty much as "risky" as you can be, given that you're guaranteed to lose money.
What will your 30-years-in-the-future self think of the decision?
-W