I'd like to get a feel for the difference between these words. When are they interchangeable and when is only one of them appropriate or preferable?
At least to me, 'topic' and 'subject' refer to something more specific than 'theme'.
For example, I might say, "the topic of discussion will be.." but I would never say "the theme of discussion will be..".
In this example, saying 'theme' feels wrong because it's impossible to decide what the 'theme' was before the discussion occurs. But we can decide what the topic will be.
But afterwards you might say "the general theme was that we should blabla..". 'Theme' generally refers to the dominant/unifying idea behind something. You might talk about themes when discussing literature etc.
I'll define those terms under a Linguistic point of view.
In a sentence it's "what we are talking about", the part about which something is said. Theme can be a synonym in this case, and rheme is what is being said about the topic.
Like I said, this can be a synonym of Topic in Linguistics. But it can also be the stem of a noun or verb; the part to which inflections are added, the root.
The subject in grammar is that part of the discourse that indicates who does the action or who is the target, for example:
1) John eats an apple.
2) The apple was eaten by John.
In the first case, "John" is the subject, it's John who eats the apple. But in the second case, the grammatical subject is no longer John but rather "The apple", while "John" is the logical subject (meaning that even strictly considering the sentence structure, you know that it's John who did the action and not the apple).
Topic and subject are interchangeable when speaking about a written document, discussion, etc. It refers to the main idea being spoken of. Theme would mean a prevalent idea present throughout the message, which is not necessarily the topic/subject, but could be. The topic/subject should be a clear idea in the message, whereas not all themes have to be.