Yes, don't beat yourself up, OP. You are a more moral person than 95% of players if you actually have the capacity to question whether what you did is right or wrong.
I did want to point out something interesting, from a poker tell point of view. As people have commented in this thread, many players will be telling you the truth when they tell you they have it. It's actually pretty common at lower limits for players to honestly tell their opponents when they're strong. This can either be as a friendly gesture, when a player is doing well and doesn't really care about that last bet on the river. Or it can be as a partially-scared thing, where a player will tell you that on the flop or turn because he doesn't want to get sucked out on in a decent pot.
Sometimes, though, players will be doing what you've described here and trying to feign that honesty to try to get an opponent to fold a better hand.
How might we try to distinguish between these two situations?
For one thing, what you've described is a pretty common way the lying version happens; you saw that he was getting ready to call and that's when you said it. This is a really common pattern; you wait until you're almost positive the guy is putting in his chips and then you say "I've got it." It's still possible you might see a player wait until the last second to say this and for him to actually have a strong hand, but the chances have gone significantly down in most cases. If a player is going to be friendly to you, he'll usually do it a little bit sooner than when you're getting ready to push chips into the pot, is what I'm trying to say.
Another clue to what you were doing was the fact that you agreed so quickly to what he guessed you had. He asked if you had a set of Queens and you immediately agreed. If he had guessed you had KK, or a lower set (or whatever was a better hand than his), you probably would have immediately agreed to that, just because you want to go with the flow of whatever his expressed fear is. Not saying it wasn't a good thing to say on your part, because it did get him to fold and would probably work with a lot of people. But it can be a clue. And, as someone pointed out, that's pinning you down to a very narrow range.
If he was a more thinking opponent, all of these things I've mentioned might have rung several alarm bells in his head. I know they would have in mine.