These days some vulnerabilities are so aggressively exploited that one can expect a vulnerable system to survive uncompromised for only a few minutes. The logical firewall can protect against being compromised before you get all the patches downloaded and applied.
A firewall probably can't protect a webserver with unrestricted access from being compromised via a bug in its web-serving code (such as the infamous code-red worm exploits). But with good/tight firewall rules (no outbound web connections from your webserver), the firewall should prevent the subsequent spread of the worm and also block access to any back-doors the worm installs--preventing further damage and making cleanup a much simpler task.
See also Firewall Limitations and Initial Logical Firewall Experiences (at the bottom of the main page).
Corey Satten
Email -- corey @ u.washington.edu
Web -- http://staff.washington.edu/corey/
Date --
Mon Jan 28 12:27:00 PST 2008