Surprise attacks

Surprise Attacks are when zombies suddenly appear in a stage. This happens in all of the stages except for the Day area and Wild West.

Plants vs. Zombies
The Surprise Attack zombies can also be referred to as Ambush Zombies and usually come in sets of three; They emerge from graves at Night, emerge from the pool in the Pool and Fog levels, and are dropped down by Bungee Zombies on the Roof (Night levels are the exception of the "come in sets of three" principle, as there are always more than three graves). The Ambush Zombies can be normal Zombies, Conehead Zombies, Buckethead Zombies, and their Ducky Tube Zombie forms, with the exception of Level 5-5 and its Mini-game version.

Plants vs. Zombies 2: It's About Time
In Ancient Egypt, there are sometimes sandstorms. There will be a warning "Sandstorm!", Mummy Zombies will get pushed forwards through your defenses. They are vulnerable to attacks while they are part of these sandstorms, but they move extremely fast.

In the Pirate Seas, there will sometimes be a warning "Raiding Party!", and a large number of Swashbuckler Zombie will attack all at once.

In the Far Future, there will sometimes be a "Bot Swarm!" warning, and many Bug Bot Imps will fall from the sky.

In the special St. Paddy's Day Pinata Party, a surprise attack was added when Leprechaun Imps fell from the sky onto the lawn.

In Dark Ages, there will sometimes be a warning "Necromancy!", and zombies would rise from tombstones.

Plants vs. Zombies

 * For Night Ambush Zombies, just use Grave Busters to destroy the graves before the final wave.
 * For Pool and Fog Ambush Zombies, when playing to the final wave, use an Ice-shroom right after the wave comes but before the Ambush Zombies pop up from the pool. This takes extremely good timing, but can stop the Ambush Zombies from ever emerging. If you cannot get the hang of this, another way to deal with them is to plant Explosive Plants in the middle of the Ambush Zombies.
 * In Fog, plant an Ice-shroom just when the words "Final Wave" appears, but in Pool, because of the mushrooms sleeping and the delay of the Coffee Bean effect, plant the Coffee Bean on an Ice-shroom just after the message "A Huge Wave of Zombies is Approaching!" disappears. Note that the Pool method will not work unless you completed Adventure mode at least once or after you earned the Coffee Bean.
 * For Roof Ambush Zombies, Umbrella Leaves will repel the Bungee Zombies trying to place them down, preventing the zombies from entering play.

Plants vs. Zombies 2: It's About Time

 * Use powerful plants like Pea Pods to defeat Mummy Zombies while they are still in the sandstorms, or use instant-kills if they get behind your defensive plants.
 * In the Pyramid of Doom, they can get as far as the second column from the left. When this happens, a Winter Melon with Plant Food can be very effective for dealing with the huge groups early on.
 * Bonk Choys can be especially effective against the Mummy Zombies, particularly when they're placed within a tile of where the sandstorm advances to, often killing them before their sandstorm even dies out. Though the Bonk Choy will continue to uppercut the Mummy Zombie in question until it is released from the sandstorm.
 * The Spring Bean is particularly effective against the Swashbuckler Zombies on most normal levels as it will often wake back up before the next wave.
 * If timed correctly, a Blover can blow away falling Bug Bots and swinging Swashbuckler Zombies.
 * You can also use the E.M.Peach to disable Bug Bots if they fall before you can use Blover.
 * In Dark Ages, quickly use Grave Buster to remove the tombstones before the warning, "Necromancy!" shows up.

Plants vs. Zombies

 * Ambush Zombies in Pool and Fog levels have seaweed on them.
 * The seaweed patterns are always random.
 * It is exactly unknown how the ambush zombies from Pool or Fog levels have seaweed on them. It is possible the pool could have algae in it, but that still did not explain the green clumps.
 * Maybe the seaweed could have came from the Tangle Kelp when they were pulled down, but the seaweed appeared before Tangle Kelp was unlocked, and still appears even if no Tangle Kelp was used in the current level.
 * Ambush Zombies have three mini-games featuring them: Grave Danger (which is a hidden Mini-game), Whack a Zombie, and Bungee Blitz (which is also a hidden Mini-game).
 * It is also unknown how the zombies got there in the first place.
 * Maybe they got stuck in there while you fought them in Day and Night.
 * The Day levels are the only levels that do not have any surprise attacks.
 * One exception to this is the Heavy Weapon mini-game.
 * In ZomBotany 2, there are no Surprise Attacks.
 * In Level 3-1, 3-2, 4-1, 4-2, 5-1, and 5-2, there are only two Ambush Zombies instead of the normal three.

Plants vs. Zombies 2: It's About Time

 * Player's House and Wild West are the only areas that do not have any surprise attacks.
 * However, in the case of the player's house, sandstorms can occur during a Piñata Party.
 * During a raiding party, the might be as little as one Swashbuckler Zombie.
 * In Piñata Party, sandstorms can consist of zombies other than the basic Mummy Zombie.
 * After the 2.3.1 update, there is a bug that after the Sandstorm ends, the image just fades away but stays on the screen.