Yesterday i had the car idling in the driveway, after about 2 minutes i smelt a nasty acetone sort of smell coming from under the bonnet then black smoke. I immediately turned off the motor and isolated the battery. Under the bonnet there was a small fire which i promptly put out. The following pictures are the item in question, i have no idea what this is or what purpose it serves. It looks pretty dodgy to me!




Can anyone enlighten me and give me some advice as to what happened, and how to fix it. Thanks in advance.
One thing to note is that the soldering on the side looks a bit dodgy, wondering if an earth wire or something came off it?