Part of the surprise has to do with the implicit statistical assumptions and part with the importance attributed to the choice.
Statistical assumptions (uncertainty reduction)
When guessing a number out of 10, one usually assumes a uniform distribution, i.e., that any number can come with equal probability. This is not the only possible choice, but this is what most people expect, when asked to pick/guess a number out of 10.
The situation with one girlfriend's name is less clear - it depends on how the names were chosen, how many girlfriends one has had, how common are their names, etc. E.g., none of one's girlfriends names could be in a hat, so the surprise might be at the fact that the name is in the hat at all. If the name is Jane than picking it is less surprising than if it were Rekefet. If you've had many girlfriends, it is more probable that a name of one of them is in the hat - a Korean friend once cited me a saying, describing this situation: If I throw a stone from a mountain, I'll kill Kim, Lee or Park.
Now, if we know a priori that one of the names in the hat is the one's girlfirend's name, and there is only one such name in the hat, than we are in the same situation, as when guessing number out of 10. Hats and other similar devices are used to simulate the uniform probability distribution that I mentioned above - any item is equally likely to be drawn.
This kind of "suprise" is formalizable and can be characterized as the reduction of uncertainty or information gained when making a choice. In fact, in information theory textbooks uncertainty/information is often introduced precisely in this way - as the degree of surprise.
Psychological factor
Assuming that the probabilistic conditions are the same - i.e., there is one and only one girlfriend's name in the hat - drawing one's girlfreends name would be still more surprising than drawing a particular number. Indeed, if we replaced the names in the hat with numbers, the statistical conditions would be the same, but the surprise would be less... unless one attaches specific significance to certain numbers. E.g., a common superstition is to attribute importance to number 13, even when it is equally drawn from, e.g., 200 hotel suits or 50 places in the bus. Same can be said about a number that is the day of one's birth or some other significant date (e.g., if you are American drawing two numbers and getting 9 and 11.)
Just in the same way, one's girlfriends name is different from other names by the significance one attaches to it: the happy memories, or the difficult separation, or perhaps possibility of making-up.
In statistical hypothesis testing one usually uses procedures specifically designed to minimize the influence of the emotional or other kinds of importance attached to the results. Thus, the assumptions and expectations have to be stated in advance, to avoid attributing importance to the result post-hoc, i.e., after the choice/experiment has been carried out (and scientists often have a lot of emotional attachment to confirming their pet theory, proving that the years of work were not wasted, having something to publish/put in one's thesis or getting research funding.)