It can be used in the "mild surprise" sense to imply a sense of surprise that the person being thanked has done the favour for which they're being thanked - i.e. to imply that they have gone beyond what was expected, and thus deserve extra thanks and appreciation.
–
psmearsJan 12 '11 at 19:08

It is definitely expressing mild surprise. Imagine you're giving a dinner party. You turn to the person sitting at the table next to you and ask them to pass the salt. They do. You say "Thank you." You wouldn't say "Why, thank you.", because there's no surprise, you were fully expecting them to pass it to you. But if someone says "I must compliment you, this stew is delicious!", you might well say "Why, thank you!", because you weren't expecting the compliment, it was a bit of a surprise. You could still say just "Thank you." in this case, but you wouldn't really ever say "Why, thank you." in the first case.