This is probably best done using vim's client-server model. There's some good guidance about using it in :help remote.txt.
Firstly, you'll need a vim client compiled with the +clientserver option. If your distribution doesn't package it this way, get the source (through apt-get source, abs, et al) and add that option.
Once that's done, you'll need to rebind your keys in tmux so that when you change windows it also sends something like the following to the active window:
vim --servername foo --remote-send '<C-\><C-N>:w<CR>'
Something like the following should work (not tested):
bind-key 0 run-shell "vim --servername foo --remote-send '<C-\><C-N>:w<CR>'" \; select-window -t :0