I recently switched to using vim inside of iTerm instead of running MacVim, and I was immediately annoyed by the strange scrolling behavior that happened while I was using vim.
Accidental mouse scrolls into the scrollback buffer would reveal strange lines and pieces of the files I was working on. Clearing the scrollback buffer would help for a short period of time, but iTerm was determined to keep logging bits and pieces of my files and status line as I went about using vim.
After googling around, I learned that the curses-based version of vim runs in alternate screen mode. Alternate screen mode lets an application draw to a different screen so that the state of your shell/prompt is preserved and can be restored when you quit that application.
This is how vim (and other curses-based applications) takes over your screen and then returns you back to your shell (just as you left it) when you exit the application.
For whatever reason, iTerm saves lines from alternate screen mode and puts them into the scrollback buffer by default. Luckily, this can be disabled by a quick visit to the terminal tab within your profile settings:
Now, after I enter vim I can immediately clear the scrollback buffer (Menu item Edit > Clear Scrollback Buffer or Cmd-K), issue the vim redraw command in ex mode (:redraw!), and I’m all set for hours of happy hacking without any side effects from accidental mouse scrolling.