I’d go further than Rich, and say that Cantor would probably have won if not for that statement of principles. It never made a lick of sense to reignite the immigration controversy when it had already died down, but the statement did exactly that. My sense at the time was that Boehner was the one really pushing for the statement and that Cantor had signed it in the interest of party unity (and perhaps to keep Boehner from forcing actual action on an immigration bill, which would have been even more divisive).
By signing it, though, Cantor put himself in an untenable position, stuck to a view he could neither defend nor repudiate, raising the salience of that view for politics generally, and raising it for his race specifically (since the majority leader runs the House floor and could schedule a vote on a bill). I suspect Brat would have done well even without this issue. But judging from the issue’s prominence in the race, it seems highly likely that it’s what put him over the top.