In my youth, totally unencumbered with anything resembling actual social graces, I learned that I got along much better with strangers if I mirrored their accents (as opposed to my native mode, Midwestern geekspeak). It worked well, most of the time, but like you, I got in the habit and would sometimes use it inappropriately.
Also: Scottish accents are much harder to actually speak than you’d think. Just so you know.