Polanksi had a meteoric rise, but now a bruising by-election loss and internal division threaten to end his leadership