Every boat has a heeling angle after which it becomes quite prone to flipping over. Here's some neat stuff and calculators if you want to check it out:
Sailboat Design and Stability
Heeling reduces the leverage that the wind has on the keel. That, coupled with a deep keel, lots of ballast, and a high displacement ratio, can make a boat quite resistant to getting knocked down.
There's more going on than the wind sadly: those damn waves. You can scare the crap out of yourself with this little video of if you like (60' rogue wave):
(also, I'm talking about monohulls)