For example, War of the Worlds.
Tom Cruise is not the hero of the picture, merely the protagonist. No one expects him to defeat the alien menace. Yet the issue must be properly resolved. If you're going to use Deus Ex Machina (which is weak sauce to begin with) you might as well do it in dramatic fashion.
Instead of bacteria saving the day, it should be a third party. The alien invaders can't be the only alien race with such technology, In a crucial moment, as Tom is fleeing the Tripods after barely avoiding becoming fertilizer, they are again seemingly trapped and facing certain doom.
Then other aliens swoop in and destroy the tripod in stunning fashion.