The short answer is both sentences have the same meaning. I would say that usage is the only difference. Although "if it was" is regarded as incorrect, this ngram indicates the use of the more acceptable "if it were" is declining (perhaps because it is seen as formal).
The longer answer is more interesting and it tells us about the subjunctive mood in Old English.
The first question that rises is what we mean by subjunctive mood. Since we are at ELL, I will try to keep this answer simple while crossing my fingers to not start a flame war :). So... a verb can be classified by different criteria, for example:
tense (past, present, future): depending on the time when the action/event described by the verb takes place.
aspect (perfect, continuous, perfect continuous, simple): without going into details, just say, the aspect of a verb describes the action/event further (is the action/event happening before another event/action? is it a continuous action? is it a continuous action that happened before another even/action? is it none of the previous?)
mood (indicative, subjunctive, imperative)
The indicative mood is the mood used most often, because is the mood we use for actions/events that happened, are happening or will happen.
The subjunctive mood, however, is used for actions/events that didn't happen but could've, or actions/events that won't happen but could.
Here's the most important point in this answer: how can we express the subjunctive mood in English? As often happens, the answer to this question evolves with history.
Old English had more forms to express the subjunctive mood than modern English. This doesn't mean that modern English cannot express the subjunctive mood. It means that:
the forms used in Old English are in decline and are often regarded as too formal.
alternative forms are created in modern English: the use of past tenses, the use of would, should...:
some of old forms still remain:
were: I wish it were Summer
be: a Florida judge has recommended that he be allowed to work
other infinitive forms: God save the Queen
1I disagree on the strong tendency. It's more a matter of education level. While it is acceptable to use both, most would prefer the second sentence. But +1 for explaining about how subjunctive has all but been completely absorbed by indicative. – Metagrapher – 2014-03-05T09:21:16.570
2The strong tendency is only my observation, maybe I should have mentioned that. I hear it used that way so often that I am beginning to wonder why "were" is still considered the correct form. – fluffy – 2014-03-05T09:44:14.513
1With most other verbs it is more prevalent to absorb subjunctive into indicative. But certain verbs take longer to change, "to be"--often irregular in any language--happens to be the stickiest. – Metagrapher – 2014-03-05T09:48:21.033
3
I agree that in some contexts "if" needs to be followed by "was", for example: "If I was rude, I'm sorry."(http://mleddy.blogspot.ch/2007/03/if-i-were-if-i-was.html) In this case I admit that I might have been rude, "was" is past simple. In the case with the train, however, "was leaving" is not past tense, it is a present time unreal conditional.
– fluffy – 2014-03-05T12:04:02.787But the problem is that the sentence is not the second conditional: "If the train left, you would hear it" is second conditional; "were" "-ing" + "would have heard" does not apply to any of the conditional constructions. So what is it? This is what threw me when I tried to answer. – nxx – 2014-03-05T13:51:06.793
You are right, it is mixed, I should have phrased it better. It is a combination, with a present condition (like second conditional) and past result (like third). If the train were leaving (now), you would have heard the announcement already, you would have heard about its leaving (before). – fluffy – 2014-03-05T13:53:33.373
@nxx The terms "1st, 2nd, 3rd conditional" do not represent any linguistic actuality. They are merely tools for teaching beginners. At your level of knowledge of English, they are no longer needed - on the conrary, they are starting to confuse you. Throw them away. – StoneyB on hiatus – 2014-03-05T23:53:03.767
Thanks @StoneyB. I was suspecting as much. But what is still getting me is how to explain this specific "exception" to a learner. Do you know if this construction has a name in the ESL world? – nxx – 2014-03-06T00:52:30.063
@nxx I've been sort of desultorily reading up on conditionals for the last couple of months looking for a framework, but I haven't found anything yet which is both accurate and under about three hundred pages long! As far as I can tell, the only broadly used framework for teaching conditionals is that 1st, 2nd, 3rd thing. I'll let you know if I find anything. – StoneyB on hiatus – 2014-03-06T01:55:27.887