The first is in the past, the second in the present
The first is used when it's already done. The second is in the present, when the situation is just done or not yet...
"Merci de m'avoir donné un café" > You already received it.
"Merci de me donner un café" > The coffee is not yet in your hand