Sure looks like an epoxy encase thermistor (older type). Unlikely it was originally mounted dangling like that. As long as no one screws around with it, it is OK, you could pull the slack, bring it up to the wire ferrule then plastic tie it. Home ownership, what fun.