Despite following all the advice in this (and other, similar) questions, I eventually found my trouble in a forgotten part of a vimrc I had taken from somewhere on the web years ago (because it was rather nicely organised), and then extensively modified for my own purposes.
But the problem area was in a little group of settings that I had never touched, back in the original file I started with. The relevant bit of the .vimrc was:
" GVIM- (here instead of .gvimrc)
if has('gui_running')
set guioptions-=T " remove the toolbar
set lines=40 " 40 lines of text instead of 24,
else
set term=builtin_ansi " Make arrow and other keys work
endif
Unsurprisingly (in retrospect), that "set term" line resets things so that regardless of what type your terminal is reporting in the TERM environment variable, you wind up with a generic, 8-color ANSI terminal. Setting 'term' explicitly inside the .vimrc is probably a very bad idea, just like setting t_Co directly.
I removed this whole block (And put the gvim settings into .gvimrc, where they belong), and everything has been working correctly for me ever since.