Hi L.,
I think you summed it up in your first sentence: she hates saying goodbye and leaving when she's enjoying herself. It's very difficult to be gracious when you are upset with the circumstances, and your daughter may not be emotionally ready to make the shift from being unhappy to putting on a smiling face and saying thank you.
There were several great suggestions listed earlier for helping with the transition of leaving. I'd never recommend punishing a child for their feelings, but warnings about time limits and warm reassurance that your daughter can come back and see friends again is wonderful and empathetic to what she's feeling.
If you are concerned about how your host interprets your daughter's sad face, there are two things you can do to convey your gratitude to your host. One is to model the behavior for your daughter. You can thank your host while acknowledging her sadness. "Thank you for inviting us over. It was a lot of fun to play with the other kids. I can see (your daughter's name) had such a good time, she's sad we have to go." Then, when you are home and your daughter is in a better space, you could suggest writing a thank you note to your host. Have your daughter decorate the front of a card (construction paper folded over is fine...it doesn't have to be fancy) with a drawing or stickers and you can write the message. This is a time to engage your daughter: "who did you have fun with today? What did you do at So-and-So's house?" It doesn't have to be a lot of questions, but let her know that you are writing a card to say thank you. Thank you cards are always welcome by their receivers, and your daughter gets a chance to contribute.
By the way, this is a tough one here, but I'm not entirely sure that children understand *why* they need to say thanks for a playdate. I don't think they have that adult understanding of the time and effort it takes to get a house ready for guests. It sounds like your daughter is just in the moment with her feelings and is being pretty authentic, which is great. Just keep up the modeling and cards, if you choose to. Gratitude is taught by us; children are rarely just born aware of it. Good luck!