I myself would decide how much you want in "cash" as emergency fund however much you need to feel comfortable. Very common advice is 3-6 months of income though I myself do 3-6 months of minimum expenses(those that I couldn't remove if I lost my job or something similar happened). This is very dependent on your situation. If you are married and both have good income, work at established companies unlikely to go out of business anytime soon and can comfortably live off one of the two incomes you can probably get away with having 3 months or possibly less in expenses. However if you are single or only have one income in your household and are working for a relatively new or failing company then you'll likely want at east 6 months possibly more since you might be without any income for some time.
After deciding how much you are keeping purely in cash everything else I would invest and just ignore whether you believe the stock market is overvalued or not. It may be, but chances are more likely you will miss out more on gains over your time investing by keeping the money out of the market than you would by simply putting it in as soon as you get it.
Why is your 401k high cost? Is it a high fee for the service itself or are all the funds high fee funds? Depending on the company these things might be worth bringing up to improve the options available or switch to a better 401k provider.
If you have maximised all tax advantaged options available to you I would pay off any high interest debt/invest in whatever you have decided to invest in. I myself would put it into Vanguard index funds.