Ek Deewana Tha is a common Hindi phrase that has been mostly related to the song Ek Hasina thi (there was a beautiful girl) and means There was a mad guy, as in a guy who was madly in love with the girl.
Here, the phrase means the same thing, though Ek Deewana Tha would literally mean just 'There was a mad guy' as Deewana literally is mad, ecstatic, or fanatical.