Does this mean he had sexual thoughts and thats why he had the wet dream?

No it means that his body has reached the age where sexual hormones are being released and such triggered such discharge. Many of those who have first time wet dream they don’t have any clue what happened