I had a very similar thing happen on my Yahoo mail account a couple of months ago, as did someone else I know on their hotmail. I only realised mail had been sent out by the undelivered messages bouncing back from defunct addresses on my list. I'm ultra cautious when it comes to anti-virus/malware so I was puzzled how it could happen. All I could think of was shortly before, I had clicked on one of those irritating 'chat requests' which are obviously spam to delete it, but I didn't quite hit the X, and it opened. I remember spending ages going through all the settings to try and stop these spam chats for good, but yahoo in their wisdom don't make it easy.
The first thing I did was change my password. I did the usual anti-virus scans but nothing showed up. That was the only occurence, fortunately. Presumably the scum behind these viruses are able to easily adapt them for yahoo, hotmail and gmail.