Lets assume we are talking about $100k in mortgage and have exactly $100k in cash, just so we have a baseline and talking about the same thing. We are assuming that if you had a crap interest rate, you'd refinance to today's rate.
If I were not 100% sure about my job, I would not invest OR pay off my house. $100k in cash would help you sleep at night knowing that you have one hell of a safety net to fall back on.
If I were 100% sure about my job and...
a) I were relatively young with a long time horizon to when you need the money (10+ years) - invest. Market returns aren't guaranteed, but given a long time horizon, they tend to do pretty well. Never, ever invest money that you'll need in a short time (less than 5 years).
b) I were older, getting close to retirement - either pay off the house or look for risk free returns (CDs, etc). The better option would be entirely dependent on unknown factors, so either one would be acceptable. Paying off the house essentially becomes a guaranteed rate of return equal to your interest rate minus any tax advantages you gain, but you lose liquidity. Personally, in this case, I would probably pay off half to three quarters of the house and keep the rest liquid until I had some more money to create a strong safety net.