Kei Nishikori upset the most in-form player in tennis, Andy Murray, in five sets after trailing by two sets to one in a New York thriller.