Do you have an OBC, i.e., an Onboard Computer gadget that shows you fuel mileage, exterior temperature, and suchlike? If so, what you've found is the exterior temperature sensor. On an E34, it clips into a slot in the front bumper beside the foglight.