alc,
You can do this, but not exactly like your example.
If you say "They deserve my..." it is the present continuous tense and "doing that" tends to describe a past event.
It should read:
"They deserved my doing that to them."
However, you can say something like:
"They deserve my contempt."
"Thed deserve my attention."
Regard