Arduino compiler uploading last saved version of sketch, not current
I haven't tried it but it would be an easy experiment to make on some throw-away code.

However, do note that saving before compiling or uploading is optional in the Arduino IDE. That may very well be the key to what you observed. I keep mine enabled, i.e., to save before any compile or upload. The option is in the Preferences dialog accessed from the menus, not in the manually-edited preferences.txt file. That might be the key to what you observed.

Update:
In that case, including the pre-defined macros __DATE__ and __TIME__ (of the pre-processor run) and __TIMESTAMP__ (of the file's last modification) in a "Hello" string can help debug this.

These pages list the standard, and common predefined macros implemented in gcc's pre-processor.
Note also that most version control systems offer similar macros that get replaced at checkout to embed a revision number and other version-control information.