You are right, the wind does influence how sound can be heard, tho I have no idea why.
As someone pointed out, the speed of sound is far faster than any wind but apparently that is not the whole story.
It happened again just a few minutes ago so I googled "train whistle at night" and this thread popped up as one of the first results. So I thought it odd that this thread started only about a month ago.