Same thing used to happen to me, well it still does to a much lesser degree... but at least you are way ahead of where I was, because I didn´t realize that I couldn´t take a compliment until a very close friend told me so, and started listing examples,very much like the one you described...
So what I did, was at first force myself to smile and say "thank you" and that is it, no more self deprecating jokes or comments, no more trying to play down me of my efforts, just force myself to say "thank you" and shut up... with time, it became less and less unconfortable and now I´m finally able to actually believe and enjoy when I get a compliment, I learned to like myself more and more...
Sometimes, depending on the person I still get unconfortable, and when that happens I just go back to the old mantra of "thank you" and shut up...