Thurman - previously undefeated - had promised to send the 40-year-old Fillipino into retirement, but was knocked down in the first round before a thrilling fight went the distance.
"I knew it was too close," said American Thurman. "He got the knockdown so he had momentum in round one. This was a beautiful night of boxing."
The 30-year-old had been looking for his 30th straight win.
Two judges scored it 115-112 to Pacquiao, while the other gave it 114-113 to Thurman.