I don't think he's a moron. He just isn't in Sherlock's class (but who is?). I think he and Sally persecute Sherlock over because of a genuine belief that he's dangerous (rather than for revenge). Sherlock hasn't really helped his case by being continually rude to them. He has tried to present himself as a possible psychopath, so it's not surprisingly that Anderson has genuine doubts about him.
But then, as you say, he doesn't take things at face value - he thinks, questions and wonders, looks for evidence and clues and comes up with ideas. It's interesting what you say about Sherlock noticing him - that's true. He didn't dismiss him. He singled him out for attention at some points (negative attention, maybe). Sherlock obviously knows he's much cleverer than Anderson, so was it just him having fun taunting somebody "weaker" or was there a little bit of rivalry and showing off going on, because Sherlock noticed that Anderson wasn't a moron at all?