Normally, the first choice is better, for reasons already explained. However, the second choice is grammatical, and in rare situations will be the better choice. Here's an example: "I've been meaning to throw a party for Sally for a long time. Thank you so much for having thrown one for her. Now I no longer need to do it.". That's the better choice because you are grateful that the job is done.