I have a standard Yahoo mail account set up with IMAP in Thunderbird (currently using version 38.1.0). I've been having this problem with earlier versions of Thunderbird too. It just didn't bother me enough until now.
Some (!) mails, irrespective whether in the inbox or already in the spam folder (called "Bulk Mail" in any Yahoo account) get marked as "not spam" (normal legit mail) right after marking them as spam, such that I'm never able to mark them as spam permanently, because they're being "de-spammed" right after marking them as spam.
Interestingly, this doesn't happen in offline mode. But as soon as I switch back from offline to online mode, they get marked as legit again, thus not having the spam flag anymore. It seems Yahoo forcibly de-flags some mails, but I don't understand by which criteria.
Or is something wrong in the communication between Thunderbird and the Yahoo server?
Does anyone else have this problem?