I heard a coworker whistling the tune from "The Good, The Bad and The Ugly" and they said it was the oldest whistling tune. Now, aside from that being obvious BS it dad make me wonder; when was whistling used to convey music and such?
While I can't comment on the historicity of whistling, I CAN tell you that the theme to The Good, The Bad, and The Ugly was never whistled. It's played on an Ocarina and a Harmonica, with drums in the background. There's no whistling at all.
The Comedian Harmonists' 1938 track 'Whistle While You Work' begins with tuneful whistling (unsurprisingly given the title of the song). I don't doubt there's earlier recordings than 1938 either, though I'd suspect that there's not many recordings of whistling before the advent of electric sound recording in 1925 - most whistlers would likely be too soft in volume for pre-1925 recording techniques to pick up the sound very well.