Lamar Odom was inspired to turn his life around by a prisoner serving hard time for attempted murder.
The former NBA star flew to Delaware back in Sept. to visit childhood friend William Gregory, who's serving a 26 year sentence.
Lamar and William chatted in the visitors' room for 45 minutes ... about Lamar's divorce from Khloe, the demise of his basketball career and the loneliness of losing his support system.
William, who's apparently discovered religion, went in hard on Lamar about the virtue of redemption, telling him the only way to find that road was to clean himself up.
We're told the chitchat inspired Lamar, who mulled it over and checked himself into rehab last week, around the time of his deceased son's birthday.
Waiting for your permission to load the comments.