If your primary weapon is Rapier and you have a 20 dex, for God's sake man, take weapon finesse

.
Seriously though, that will be your most powerful feat. Also, with a +5 dex bonus to armor, the heaviest armor you are going to be able to wear (that is not mithril) will be studded leather - a.k.a. light armor. So right away Ranger and Rogue are looking pretty good. However, Fighter and Wizard would also be options.
If you want agility and quickness with dodging and parry you are looking at expertise and dodge for defense and Mobility, Spring attack and tumble for agility. You might also want to throw in Jump and Balance.
There is nothing in the PHB that specifically deals with studying your opponent's weaknesses and using them against him. In 2E there was a NWP I believe in the Ninja's Handbook that dealt with doing exactly that...I think it was something like know the school or some such thing. In one of the splat books, I believe they do something similar with sense motive. I have always thought that there should be a knowledge out there that would cover fighting styles that could be used to know the strengths and weaknesses of different styles - but all of this is subject to sources outside the PHB. For the concept though, Sense Motive and an appropriate knowlege skill would seem to do the trick.
As for equipment: boots of springing and striding, cloak ofprotection, amulet of natural armor, gloves of dexterity, keen rapier, ring of evasion seem to fit the bill (I know way more than you can afford).
So let's look at what we got:
Armor - light
Feats - Weapon Finesse (Rapier), Expertise, Dodge, Mobility, Spring Attack
Skills - Tumble, Jump, Balance, Sense Motive, Knowledge (fighting styles)
So you have a couple of routes to achieve these ends:
Fighter 6
Pro's - best BAB, all feats (+2 others - I would choose from Weapon Focus, combat reflexes, Quickdraw, Improved Disarm, Whirlwind Attack, Blindfight, Weapon Specialization, Improved Iniative)
Con's - poor Reflex save (goes against the grain of an agile character), low damage output (raises the importance of getting weapon specialization), heavier armor proficiencies wasted (unless you can get ahold of some mithril medium armor), crossclassed skills
Rogue 6
Pro's - Sneak attack obviates the need for weapon specialization, all the skills you could ever want (you will also need bluff to be able to feint to take advantage of sneak attack when not flanking), good reflex save, evasion (don't need ring), uncanny dodge
Con's - medium BAB (not that bad since you have such a high dex and with Gloves of dexterity this is almost a nonissue), only 3 feats (I would choose Weapon Finesse - Rapier, Dodge, and Mobility) this also means that your feat selection in the future is going to be limited. I would go for Spring Attack, Expertise, Improved Critical, Improved Initiative, and or quickdraw. If in the future you are not limited to PHB definitely get ET.
You could go for a combination:
Fig 3/Rog 3
Pro's - Better BAB than straight Rogue, can still max out necessary skills, can take all 5 feats, better reflex save than fighter, still have 2d6 SA dmg, have evasion and uncanny dodge
Con's - None (in terms of your concept). You do not have as many skill points, don't have as high of a max save for either F or R, have less HP than the fighter and with your con that can be dangerous. However, for your concept this would seem to fit the bill the best.
You could also go for quite a different combination.
A Ranger either in combination with the Fighter or Rogue or both will give you the ability to fight with 2 weapons. I would stay away from Strainght Ranger as you can't get Weapon Specialization to compensate for low damage, you get no bonus feats, and no SA.
Ran 3/ Fig 3
Pro's - Still get all 5 feats, have best BAB, get TWF, gain access to some minor magical abilities in future and can use wands
Con's - poor Reflex Save, same skill problem as with straight fighter, you could get the same benefit of TWF without the limitation with a Fig 6
Ran 3/Rog 3
Probably worse combination as you lose out on the feats. Only go this route if you really want TWF and don't want a lot of feats.
Ran 2/Fig 2/Rog 2
Not a bad choice (probably the most min/maxed choice).
Pro's - can get all 5 feats with TWF, get SA which will increase (more slowly however), evasion, max out appropriate skills
Con's - over the long run, you will only ever get 4d6 SA which is poor if that is what you are shooting for. You should be able to keep your skills maxed out but at the cost of all the other skills (not sure if that matters).
The other option is to consider Magic. Wizard is the favored class. Some spells warrant particular attention:
Expeditious Retreat (if you can't get the boots) - You will be amazed how much this helps with Spring Attacking.
Mage Armor - Better than any nonmagical nonspecial materials armor for your dex bonus.
Shield - one of the best defensive spells in the game. You are looking at a 26 AC (w/MA) without using expertise, dodge, or fighting defensively - you will effectively be unhittable.
True Strike - Even with maxing out Expertise and fighting defensively, you will still always hit. Also, this opens the door to Power Attacking, which is another compensation for your lack of damage output with the rapier.
Blur, Invisibility, Blink, Displacement, Improved Invisibility - all deny opponent their dex bonus. If you are a rogue, these spells are indispensable
Cat's Grace - increase AC, AB, and Reflex Save
Endurance - increase low HP's
Jump, Spiderclimb, Levitate, Fly - increase motility. Especially with fly, I recently ran an adventure where the party just acquired this spell and they were all flying. It was ridiculous how far they could move in a round.
With a high enough UMD and access to the above spells, the wizard is unneccessary. However, this puts the ball in your DM's court and you lose all control to have such abilities. This also deviates from the notion of a duelist in the traditional sense.
It's really important to know if you will be limited to the PHB for the entire campaign. If you are not go for the duelist - it fits your concept perfectly - as has already been iterated. Moreover, if you decide for rogue, you really want to get expert tactician. Finally, look to Dragon 305 and the duelist one (sorry, forget the number), there are a number of really REALLY cool feats in there. That would match your concept.
Hope all that helps.