Ive heard that you shouldnt give dogs caffeine and chocolate, and a quick google around seems to confirm this:
"The symptoms of poisoning include vomiting, breathing very rapidly, hyper-excitability, and agitation. If ever you see this, then take the dog to the vet hospital immediately and have them call a poison control specialist."
So apparently most dogs that do this end up ok but it depends on the dog and the amount of coffee.
Cant say I blame the dog though. I dont have a heightened sense of smell and Im sometimes tempted to munch them just from the aroma.