Investing your money, as opposed to locking all of it away in the bank, is a great way to accumulate wealth over time. And in a recent survey by Wells Fargo and Gallup, investors -- defined as U.S. adults who have $10,000 or more in stocks, bonds, or mutual funds -- remain fairly optimistic about the economy.

At the same time, most are relatively fragile in the face of an unforeseen financial emergency. Case in point: Only 33% of investors say they're prepared to deal with an unplanned $10,000 expense. And that's a problem on multiple levels.

Will a whopping bill damage your finances?

At first glance, you might be thinking: "How likely am I to encounter a $10,000 expense?" But if you own a home, there are numerous things that could break down with repair costs that might well exceed that figure. Replacing a central air conditioning system, for instance, could run you upward of $10,000, depending on the unit in question and size of your living space. Similarly, if you live on a property with a septic system and come to need a new one, you may be looking at a similar figure if the job is complex.

Man holding a tool, talking to woman in a kitchen

IMAGE SOURCE: GETTY IMAGES.

But it's not just homeowners who might encounter a humongous bill out of nowhere. If you get hurt or fall ill and need medical services your insurance won't cover, you could wind up paying many thousands of dollars just to recuperate.

Furthermore, you never know when you might get laid off at work, thereby losing your income in the process. Granted, that's not an expense per se, but it does create a situation where you could find yourself in need of $10,000 (to pay your regular bills) in short order.

That's why it's so important to have emergency savings -- more so than an investment account, in fact. Without an emergency fund, you'll likely be forced to do one of two things when a large, unanticipated bill lands in your lap: liquidate investments, or charge that bill on a credit card. In the former scenario, you risk losing money if the value of those investments has dropped since you bought them. In the latter scenario, you risk racking up loads of interest and possibly damaging your credit in the process. Talk about a lose-lose.

First build your cushion, then invest

Make no mistake about it: Investing your money is a great way to fuel its growth. But before you load up your investment account, make sure you have a minimum of three months' worth of living expenses socked away in the bank, and ideally, more like six months' worth of expenses. This way, if you do lose your job or get smacked with a sudden bill, you have cash reserves to tap.

Furthermore, if your income is variable, you may want to stash away a little more money in a standard bank account -- say, nine to 12 months' worth of living expenses. Beyond that, however, you'll actually be doing yourself a disservice by keeping it in cash, so it certainly pays to invest your savings beyond that point. This way, you'll get the best of both worlds -- the safety net you need for emergencies, and the opportunity to build wealth for the future.