In Avengers: Infinity War, when Thanos
kills Loki and all the other Asgardians,
he then leaves
Thor injured, instead of killing him.
As mentioned in the comments, I believe Thanos didn't kill for the sake of killing - he had a purpose.
With that in mind, he only killed Loki because he professed his "undying loyalty", then immediately attempted to kill Thanos. Thanos would have seen this to be a lack of loyalty, hence he killed Loki - not because Loki was a threat, but because he lied.
Whereas Thor never did such a thing, hence he wasn't killed, despite being a potential threat.
If Loki never did what was mentioned above, he most likely would still be alive.
Expanding on what Edlotihad said, Thanos would have thought that
Thor would die in the explosion of the ship and also as Thor was beaten up Thanos would have thought that Thor wouldn’t be a threat to him because he does not posses any weapon and as thanos attacked nidavellir and killed almost all the dwarfs and stoped the forging process Thanos would also have thought that Thor wouldn’t be able to forge a new weapon as well.