Being able to make encounters on-the-fly is an issue with some RPG's. D&D and some other systems have tried to make it easier, but there's still a matter of balancing encounters to the party.
Prepping as a GM is sometimes necessary if you're not good at improv, or system is hard to improv in. So, my recommendation is to just call it a night and let them know (honestly) that you weren't prepared for this part.
Then, what you do after can go one of several ways...
1) send them packing (kind of a dick thing to do)
2) hang out (go catch a movie, watch some tv together, chat and have a beer)
3) use the time to handle misc "bookwork" / upkeep. Maybe one of the PC's is ready to level; help the player with that. Maybe a player needs to add more to their back-story; have them flesh that out. Maybe the party wants to do a bit of shopping; RP that (very easy to do, b/c it should simply be some RP + looking up some costs in books + haggle rolls). Ask the players what they think of the campaign so far (but not in a "needy" way), and ask if they have any suggestions. This is what my group and I called "EMB" (extra managerial bullshit) that was necessary to do occasionally, but sometimes boring / tedious.
4) make the players help you with prep work for next session ... maybe there's a part in the adventure where you need to have them roll some dice for their characters, but you don't want to let them know what they rolled..so, have them pre-roll like 20 rolls. This is especially good for adventures that have some hidden skill checks or charts where special stuff happens. If you have some DM prep work, you can ask the players to make a bunch of rolls and write down what they roll, but they don't know waht they're rolling (they're rolling stats for a new encounter, they're rolling to-hits, etc).
The issue with modern table-topping is that most RPG'ers have already played CRPG's that provide open world experiences. So, they want to do what they want when they want.
And, given a choice, as others have already said, PC's will be more cautious then bravado. If they don't see any rush in doing something, and think there's plenty of chances to recover, then they'll go all-out on an encounter to try to milk it (eg: interrogating enemies, etc).
That's not something to be stifled. Smart game play should be rewarded.. and in your case (as others pointed out) the players were rewarded by getting to the next town to hang out and recover.
But, if you absolutely want to push them in a direction that you already have planned out, you need to leverage some trope...
eg: (note, most of these feel very railroady)
1) THE CLOCK IS TICKING .. PC's need to go into that place you prepped, b/c some event will happen in X time that they need to stop. EG: the princess will get murdered, a plague will get unleashed and threaten the town, etc. This adds a time pressure to the players. And, if they decide to dick around, then you follow through on the threat. If a party of adventurers doesn't accomplish the tasks given to them, then word gets around the kingdom that they're unreliable. So, there's consequences.
2) YOU SHALL NOT PASS .. the path ahead is blocked by unpassable foliage (but, wizard could blast it, so maybe not a good choice). The party comes across a massive encampment of enemies (like an army) and the are is crawling with scouts, so it would be prudent for the PC's to back-track to (the place you had prepped) and hide. You can even just be super-blatant.. like.. the party is surrounded by an insanely impenetrable forcefield and only has one way to go.. into the (place you prepped). (This method is super railroady, and PC's will get ticked off if there's no game rule explanation for it... EG: using a force field of nigh-impenetrability that isn't in the rule book at all is basically a big FU to the players. Sort of a "your PC's will never have this kind of power, but as the GM I can just make up shit any time I want, even if it breaks the laws of magic / physics in the game world I created." So, have to be very careful with that.)
3) YOU HEAR SOMETHING ... you hear some cries coming from (the place you prepped), .. or some other noise that may entice the players... (the noise could be valid.. maybe they hear the cries of someone being kidnapped.. maybe some trolls are carrying some humans off into a cave to eat them, and the party could save them while also getting roped into the adventure. Or, the noise could be a trap.. some enemies are making a noise to lure the players in... like making it sound like a damsel is in distress.. but actually it turns out to be a female enemy that's luring them in.) The "hear something!" trope works well with the "blocked path" trope.. in that you can make them hear something and lure them in to investigate, then once they're at a choke-point-of-no-return (eg: cave entrance) you can have something block their path (eg: cave in).
4) RUN FOR YOUR LIVES! .. just toss out an enemy that is so blatantly abusive that the party has no choice but to run for their lives. Make it an enemy that would logically be in the area. This often works for really difficult animals.. eg: just have some massive giant bear come at them, or a pack of dire wolves or something.. and the things are chasing the party. The party tries to think of a place to go hide... back to the cave they saw.. b/c they'll think they could at least choke-point the area to face fewer enemies at a time. Then, as the hard enemy gets near the cave entrance.. it stops just outside, as if it "senses an evil presence". Now the party is stuck between a rock and hard place. They can either go fight the hard enemy (which would most likely kill them and thus be suicide) or delve deeper into the place you prepped and hope they get out alive. This in effect pulls off the YOU SHALL NOT PASS, but herds the party while doing so.
5) KIDNAPPED! .. Ok, fine.. the party makes it back to town. They recover. Then they wake up in some predicament in the middle of the place you prepped, b/c they were kidnapped in the middle of the night. How did the party not notice anything? Because the inn room they rented is part of some conspiracy that works with the enemies at the place you prepped. They have secret openings in the inn room the party rented that vented in sleeping gas. Or, the party got struck by some suspended animation spell.. something (again, have to be careful with BS'ing this too hard, or players will clearly think they're being railroaded). This could expand upon the adventure after the party clears the one you prepped, b/c you cuold then expand it to make something more sinister going on.. eg: instead of just "the goblin cave" being some one-off place to go gack, you cuold turn it into a group of slave traders.. the goblin cave is a place where they do some business, but clearly there's stuff going on in town suggesting a larger network of enemies that have covered the lands that the party can investigate and try to stop.
So, those are some tropes to basically railroad the party.
I wouldn't punish them for doing what you wanted them to do.
My group and I (me being GM) used to joke in adventures, stories and movies about how it seemed like the game world (ran by GM) was basically saying "Your characters have gotten too powerful.. the GM must now blatantly try and kill them now." You don't want to come across as blatantly railroading the party as punishment for smart decisions. You want to foster smart decisions.
But, you can add subtle pressure.
But, ultimately.. you, as the GM, are not there to force your story on them. Yuo're not a stage director where the players are actors forced to perform your script. The players are there to make their own story. Let them do what they want. If you're not prepared for it, simply say "I'm not prepared for that part."
You should plan to prep a bit of stuff in your own time.. I wuoldn't go so far to make it feel like a new part-time job. Often just fabricating some random encounters or pre-rolling some stuff might help.
Not being able to play b/c you're not prepared for an area is sort of punishment for the players as it is. They came to play. If they realize they can't play, b/c you didn't have the area they went to prepared.. b/c they plowed ahead.. then they'll probably negotiate with you (if you're honest about it).
"Oh.. gee.. ok, so you have that cave area prepared and that's it? Ok.. well, uh.. we suddenly feel 'inspired' to head back there and investigate."
My old party and I used to joke that the players hadn't "unlocked that DLC yet" when I didn't have an area prepared...
"As you head towards the town (that I didn't prepare) a red flashing warning message comes up saying 'out of bounds'... you guys should probably head back, b/c that area doesn't work yet."
You can make a joke about it. Players will often find honesty and joking coming off MUCH better then feeling like they're railroaded. Because honesty and humor is human... you can't do everythihng, you can't have everything prepped, so just own up to it and make light of it. They'll forgive you, and chances are good they will then just railroad themselves in order to keep playing. Because you were honest about it instead of trying to be sneaky.