Because the dragon is smart, a 20th level character would need the following:
1) Good damage with a touch attack that doesn't have spell resistance, or the ability to hit a minimum AC of 43. It would actually be higher due to a +5 ring of protection or potion of shield of faith, amulet of natural armor or potion of barkskin +5 and haste, so assume AC 49-54.
2) True seeing (the dragon has displacement and greater invisibility up, and the spell seeming to mess with you).
3) Protection from fire
4) Ability to see though smoke/blind sight
5) A lot of hit points
6) A good Will save or immunity to fear (or you will run away).
7) Immunity to stunning would really help (due to weird, stunning critical, greater shout).
8) Ability to beat the dragon in melee when it is in an anti-magic field.
If it were not for #8, I would say that an alchemist would be your best bet. That gives you the fire protection, an attack that can hit the dragon, blind sight (via echolocation extract), true seeing (via extract), immunity to critical hits (via elemental body), extra hit points (via greater false life and heal), spell resistance, and all kinds of protection from melee attacks.
If the dragon were in an anti-magic field, then a gunslinger would be a good bet (provided gunpowder is not supernatural), but the gunslinger lacks some of the other points.