Khan was elected because firstly he was the official Labour candidate, and Labour has usually had a small overall majority in London politics. Secondly, because his Conservative opponents, both times he was elected, were of poor quality and conducted weak campaigns. Thirdly because his manifesto and campaigns focussed on specific local issues, not generalised national issues. Fourthly because he legitimately present himself as a Londoner, having been born and lived and worked in the city all his life - unlike some of his opponents.
Besides these, the fact that he's of Pakistani origin was pretty much irrelevant.
Well argued.