What is the difference between a phrase, an idiom and an expression? I am looking for the context where one is more appropriate than the rest. I've been using idiom and phrase more or less interchangeably.
This question asks nearly the same thing.
A phrase is “a small group of words standing together as a conceptual unit”, while an idiom is “a group of words established by usage as having a meaning not deducible from those of the individual words”. So, the difference is that an idiom as an established meaning not directly linked to the individual words. Any idiom is a phrase.
As an example, “raining cats and dogs” is both an idiom and a phrase. “A herd of cats” is a phrase but not an idiom.
Expression has about the same meaning as phrase, except it is usually used of a phrase which is in common use.
So an idiom is a certain sort of expression, which in turn is a subset of phrase: idiom > expression > phrase.
An idiom can be a single word, if it's used in a way that isn't its literal or dictionary meaning. For example, "moonlighting" to mean having a second job is an idiom. A phrase is any clump of words ( "that dog over there", "my cousin's wife's sister", "because it was hot", "as fast as I can"), and an expression is a phrase that is an idiom.
So: all expressions are phrases, and all expressions are idioms. But some phrases are not expressions, and some idioms are not phrases or expressions.
Further, "just because you say it doesn't make it a saying": opinions may vary on whether a particular phrase is an expression or not.
We have three terms here: expression, idiom and phrase.
An expression is a saying. It may be a colloquial, less formal (or more polite) way of expressing something in less literal terms:
How do you do? is an expression. You don't expect someone to actually tell you how he is doing; he should just say How do you do? because it means little more than "hello" 
A phrase is a semantically meaningful sequence of words. A phrase is not typically a complete sentence. I consider a phrase to be more like a grammatical construct e.g.
- needless to say
- causing permanent bodily harm
- way of the world
Idiom is more subtle. It can be informal or merely non-literal, and either a phrase or a complete sentence. Here are two examples of idioms that are also phrases:
- brick and mortar (a traditional business, in contrast to e-commerce)
- town and gown (when a school or university is in close proximity with a surrounding community, this is a way of distinguishing between academicians or students versus local residents who are not affiliated with the school)
Here's the subtle part: It requires an idiomatic understanding of language to use these non-obvious forms of speech correctly. Idioms resemble metaphors, but are more general.