Sayyiduna Ibn Abbas (may Allah be pleased with them both) narrated that the Messenger of Allah (peace and blessings be upon him) said: "The prostration of Surah Sad: Sayyiduna Dawud (peace be upon him) performed it as repentance, and we perform it as thanks."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12333