Here's Q's greatest weakness: he's bored. His primary goal in any interaction is to entertain himself. He put humanity on trial because he thought it would be fun. Sure, he could have made the Enterprise blink out of existence with a thought -- but he didn't, because he thought he could have some fun.
So, the matchup is not an omnipotent being against the Doctor: it's a risk-taking, thrill-seeking omnipotent being against the Doctor. And those are odds the Doctor can work with.
Earthbending is going to get them inside. The entire team is on a rock sled that Aang moves along -- sweeping away mines and fences as it goes. Between moves he raises rock walls to knock away SHIELD soldiers, smash towers, and eventually blast them straight through the walls. It also provides shielding from gunfire, Cyclops' beams, and Gambit's cards. Domino, with the ion blaster, takes out the sentinels and electric fences, using her luck to improve the outcomes. Legolas takes care of the gliders, and Storm. Blue Spirit and Aragorn handle Warpath. Sabretooth rampages along the way, taking out Gambit if he's foolish enough to get close.
Once inside, the team sticks together. Aragorn, Blue Spirit, and Sabretooth take the close-in opponents while Legolas, Punisher, and Domino handle further-away threats. Aang takes defense using airbending, keeping the enemies off-balance. Domino's luck powers make Nightcrawler and Kitty Pryde have unfortunately-timed teleports and phases. Bishop and Jubilee are handled the old-fashioned way.
In Professor X's room, Sabretooth's mission is to keep Wolverine occupied, making Wolverine not a factor. Everyone except Aragorn and Legolas engage the other three defenders -- they don't need to keep them busy long. Aragorn and Legolas don their elven cloaks; Aragorn goes straight for Professor X, while Legolas goes for the nearest vantage from which he can get a clean shot. Doesn't matter which one gets there first.
Escape: Aang uses firebending to cover their retreat from the inner room. Having torn through the place already, they don't face much resistance in front of them.