For a given volume, light things float and heavy things sink. The cup sinks when you fill it with water because it becomes heavier, and therefore more dense. When the cup becomes more dense than water, it sinks.
The cup would sink just as well if you filled it with rocks, lead, etc. The condition for the cup to sink is that its weight must be greater than the weight of the water it displaces (i.e. its weight must be greater than the weight of a cup exactly the same size, but made out of water and filled with water.)
You can read a number of other questions on similar material here: https://physics.stackexchange.com/questions/tagged/buoyancy
It's a combination of two effects: buoyancy and adhesion.
Buoyancy lifts the cork up as much as possible, until it displaces its own weight of water (Archimedes' principle). For this reason, the cork will seek the highest point of the water level.
Because of adhesion between the water molecules and the glass, the water level is highest at the edges (the water level is concave). As a result, the cork moves to the sides.
If you'd fill up the glass to the brim, the water level becomes convex (due to surface tension), and the cork will stay in the middle.
See also this site and this youtube video.
Extra Info
By coincidence, a very similar question came up yesterday on a Dutch science program, and I learned there's actually a name for this phenomenon: the Cheerios effect. The name is derived from the fact that small floating objects on a liquid, like bubbles on water or cheerios on milk, tend to clump together, or stick to the walls.
The reason is the same as my answer above: there are two forces acting on a floating object: the buoyancy (which tries to push the object out of the liquid) and the surface tension (which tries to keep the object in the liquid). The result is a compromise, where the object is pushed partially out of the liquid, causing the surface to deform: it forms a small hill.
Nearby floating objects are affected by this deformation: a floating object seeks the highest point in a liquid (the buoyancy causes it to rise and move
upward along the surface), so it will move towards the 'hill' formed by the other object. Therefore, bubbles (or cheerios) will cluster together.
A similar effect happens with objects that are denser than the liquid, but are not too heavy, so that they don't sink thanks to the surface tension. Paper clips are an example. These objects actually push down the liquid, creating a small 'valley' in the surface around them. But such object will also seek the lowest point on the surface, which means that nearby dense objects will again be attracted to each other. So paper clips also cluster together.
What happens when an object less dense than the liquid (e.g. a cheerio) is next to an object denser than the liquid (e.g. a paper clip)? The first creates a hill and seeks the highest point, the second creates a valley and seeks the lowest point. So the result is that they will repel each other!
There's a very nice paper that explains these effects in more detail:
The 'Cheerios effect' (Vella & Mahadevan, 2004).
Best Answer
Increasing surface area has no effect on buoyancy. Changing volume does have an effect. When I was young and skinny, I could sink to the bottom if I just let most of the air out of my lungs. But I still couldn't float properly even with full lungs until I learned to push the air in my lungs closer to my center of mass. If you don't have enough lung capacity to fill your lungs with air and thereby reduce your mass-to-volume ratio to less than that of water, you will sink. If your buoyancy is slightly positive and your center of mass is below your center of buoyancy (tends to be somewhere in the lung area), then your feet will sink and the top of your head will stay just above the water surface.
Most people tense their stomach muscles when they're not relaxed. If you relax your stomach muscles, your diaphragm can move downward (that is, toward your navel) and thereby move your center of buoyancy the same direction. Alternatively, if you stretch your arms above your head (that is, away from your navel), you're moving your center of mass upward toward your center of buoyancy. Full lungs, arms above your head, and relaxing your belly muscles should make you float just fine.