The Operating System is largely irrelevant. I ran my first firewall on MS-DOS, an operating system without security, and the firewall was never compromised. Nor were the systems behind it. What does matter is how much the firewall machine is exposed to the network. The more network services you enable on the firewall, the larger the likelihood of firewall compromise.
Firewalls are strange things.
You can actually build a more secure system from less secure components. In my personal opinion, a single machine cannot be a good firewall, because one single failure is sufficient to expose the inside network to attack. A good firewall consists of multiple fail-safe barriers that provide multiple layers of protection. Marcus Ranum got that right some 10 years ago with the DEC Seal firewall.