From what I’ve been told, it was played by Eddie Van Halen on the original recording.
How it happened
The producer of Thriller at that time, Quincy Jones Initially contacted Van Halen regarding the guitar solo part. He thought it was a prank call at first but then learns that the call was legitimate. Originally, Eddie was willing to do it as a favor or free of charge, I don’t know if it was changed later or not.
He made 2 versions of the solo, the first one being the original and the second one being the more ‘smooth’ version because the first one seems too tough to fit the song.
Many other guitarists filled in the guitar solo position on MJ’s live performance including Slash.