I had almost the exact same problem at school, except with me it wasn't because of them bitching about one particular person; they were always talking about people behind their backs and making value judgments about them... I didn't like it and like you, I too didn't have any friends for a year... In my last year of school though, I got along pretty well with some of the new kids; we even went out on road trips together, it was awesome.
I agree 100% with your philosophy, it teaches you how to be independent and not caring about what people think. Also, I find that you tend to become like the people around you if you give it enough time; so if you surround yourself with nasty personalities, you will probably become nasty yourself... If on the other hand you surround yourself with respectable people, then you will become respectable too.