Germany's Roger Kluge caused a massive upset with a last-ditch attack to defy the sprinters and win stage 17 of the Giro d'Italia in Cassano d'Adda.