Canada's Robert Wickens took his first GP3 Series victory in a chaotic feature race at Hockenheim.