You have probably played over unknown chord progressions by ear, simply playing those notes that you "felt" were right, trusting your musical intuition. When doing this, if the chord progression is simple and has no modulations at all, after a few bars you probably recognize its tonal center and start playing scale patterns and predefined licks. However, in order to better train your ear, you should forget every pattern and just play isolated notes, not thinking about the scale they belong to and leaving all your musical knowledge aside.
Here is a little exercise I have been practising lately, which will also help you improve your skills, but using a different approach. When improvising by ear, you try to find notes that "fit" into the chord progression. Well, let's do it the opposite way: try to find notes that do *not* fit. Try to play the most dissonant solo that you can improvise. Once again, do not use patterns (I mean, if you know somehow that the song is in the key of A minor, don't play a A# minor scale or any other one that does not fit). Play random notes. Picture the note in your head and then try to find it in your instrument.
If you play guitar, you can play the same note in different positions. Explore the whole length of the neck. That will not only train you ear, but help you gain a better understanding of your instrument.
Sometimes, you might play something that is not so disonant and find interesting melodic tensions.
If you feel like it, you can combine this exercise with Tristano's "Atonal Scat Singing" (i.e. trying to sing the notes that you play)