Because the first verb in the sentence is written in the past tense ("thanked"), the correct answer is the past perfect, "had done". He thanked in the past, and what he did happened even before that (had done).
"Have done" (present perfect) is more of a recent past.