Indeed it looks like a bug. I discovered it because I needed to set an HTTPS_PROXY environment variable for use with github's client, as a workaround for some network issues we've been having.
App-specific env-vars can be predefined in the app's Info.plist:
http://developer.apple.com/library/...BPRuntimeConfig/Articles/EnvironmentVars.html
It's the LSEnvironment key (a dictionary).
Assuming the env-var is only for a specific application, I would have edited the Info.plist of the app.
If the env-var is for a specific app and some shell commands, I would have edited Info.plist of the app, then set the env-var in my shell's startup script.
I only use ~/.MacOSX/environment.plist for safe (no secrets) data.
Our proxy requires authorization and hence I needed to embed my username/password in that environment variable (which of course is plain text). This obviously isn't security conscious but I had no choice at the time. Once we no longer needed the proxy, I removed the env var from the plist and it proceeded to remain in the environment after relogging and I was highly disturbed that my credentials were still there even after I believed they were removed.
I tried setting the env-var in the plist to empty, and that worked. When I deleted the empty var, it still showed up as empty. Still not what was expected, but not leaking a secret, either.
Setting it to empty might be fine, if and only if whatever app is looking for the env var treats an empty var as an being unset/undefined. But this likely isn't always the case. I don't have any examples where an app would treat an empty value differently from an undefined value.
I wasn't suggesting that it would be a universal work-around. I wouldn't expect it to be. Work-arounds are often like that: they break outside a small range.
Regardless, this is definitely unexpected behavior that I hoped to find an explanation for. I'll submit a bug report.
Since the bug appears in Lion, I'd submit it for that OS version, but also say that it appears in Snow Leopard, too. And point out it doesn't occur before Snow Leopard.