Note that, in many of the top STEM PhD programs (I speak from a Computer Science perspective), research experience trumps everything else. So even if you have an average/slightly-below-average GPA, you can always try and compensate by (1) being extremely active in research in your last one-two years of undergrad, and hopefully getting a publication or two out (2) doing extra work (this could overlap with (1)) so that you have excellent recommendations. Finally, it is often the case that a lot of 'brilliant' students have no idea who they want to work with or what their research focus is. This is a major weakness in applications. You can always gain a competitive edge by identifying potential advisers early and initiating contact. Read the papers that come out of the group you would be interested in joining. This will enable you to objectively validate your interest in your statement when you submit the application. No adviser would trade an enthusiastic, energetic, focused candidate for someone clueless (and often arrogant, on account of merely having superior grades).