Sorry to hear it, Grace. I know it's never as easy to do this as it is to say it, but try not to take it personally. It sounds like your assessment of the interview was right on, you did great, but it just didn't happen to work out this time. It happens to us all one way or another sometimes.
When you calm down, I think thanking them for the consideration would be a classy (and potentially helpful) move. Personally, I would write a letter to do this as Cindy suggests. It'll help keep the door open and maybe put you in their good (*ahem*) graces should another opportunity arise. Unless you've been in closer than usual contact, at least in the US I would think that a letter would be more customary than a phone call for that.