Ambushes are something that always make me more than a little nervous when it comes to GMing. I don't mind when the PCs set up a good ambush. If they do it right, they should reap the rewards. However, if NPCs are ambushing PCs, I get very nervous. An ambush is a huge force modifier. If that first round goes well, you might not have a PC left on the board. Or you could have just enough that it will be rounds of struggle and feeling powerless before the fight is over. Today I want to talk about it, some ways to mitigate it, and some things to check for.
When In Doubt, Shoot An NPC First
One of the easiest ways to have the impact of an ambush without the full mechanical doom of one is to simply kill one or several NPCs in the ambush. This means putting NPCs around the PCs first - and those NPCs dying so hopefully they're not plot carrying NPCs - but it still lets you cut down part of the party without actually taking out any of the players.
The players are still not in an ideal position, and the ambushers are, but none of them are down and out of the fight.
The more deadly the intent of the ambushers, the better this can work. No matter what kind of game you're running, it's going to suck for at least one person having the GM roll some dice then tell them they just took lethal damage.
If It's To Capture, Cut The Mechanics
Another thing you can do - at least in the case where the point of the ambush is to use overwhelming force to capture the PCs - is to just skip the mechanics and handle the ambush as a cutscene or just a "you wake up in chains" moment. Some players may balk at this. Some players may want to roll it out. That's fine, provided they know upfront. Tell your players "Look, this next part has more than I think you have a hope of handling so do yo want me to just narrate what happens or do you want to roll it out?"
Some players will just to just go with it. Others will want to roll it out. At least in that case they have informed consent for when things go bad. And you can always offer to stop rolling things out when the tide has clearly gone against the players to give them the option once again.
Beware Of The Consequences
You ambush the players once, and they may take it as a one off. They'll be more aware of things and perhaps that'll be fine. More cautious adventurers/PCs isn't the worst thing. However, ambush the PCs too often and they'll become paranoid. How often "too much" is depends from player to player. Some players just assume everything that can go wrong will at every turn. Others will take a while before they start jumping at shadows.
The thing is, if your PCs go paranoid from being ambushed, it can both slow the game down and be something hard to work around. PCs taking everything as an ambush is where Murder Hobo'ing can go out of control.
So keep that in mind, and while you shouldn't be afraid to ambush the PCs when it is warranted. Just don't do it too often, or for the wrong reasons. It's a tool, a powerful one. Don't reach for it if a smaller tool will work.