Since this problem happened with your other cog set (the SRAM one you mentioned) I'd be surprised if it were related to the cogs.
And since it happens under load, I would think about things that might change with pedaling force.
Maybe your frame is flexing and applying force on the shift cable. I don't know why that would only affect the third gear, but maybe this is the one that's most eager to shift, since the chain is neutral here and easy to bend in either direction.
Also, maybe the cable housing is doing something as you pedal. Bar end cable housing is pretty long and can do stuff when you're riding.
Just a few quick ideas for your consideration