Hamilton wins crucial, chaotic Singapore GP