I think that to create these special moments, one must be open-minded and, like the others have said, friendly. I'm in a female in my mid-20s and generally travel alone, and I am a very social person... I'll talk to anyone!
My favorite experience with locals was when I was in Strasbourg, France last year during the Christmas Market season. At the time, I was living in Burgundy as a language assistant and was on Christmas Break. Originally, I was gonna go with two other girls but they ended up not being able to go, so having traveled solo before, I decided to go anyway. So, the day comes and I took the train up to Strasbourg. There ended up being an accident in Bourg-en-bresse that day so I ended up getting to Strasbourg 3 or 4 hours late, so by the time I got there, it was dark and dinnertime.
When I finally got there, I was really hungry so the plan was to go to a corner store to buy some fruit and some bread, check into my hotel, and go to bed early so I could get up early to check out the city. Well, I ended up wanting a real authentic Alsatian dinner, so I decided to go to a (pretty fancy) restaurant all by myself, even though I did not know how safe or unsafe Strasbourg was, since it was my first time there. So I get there, sit down, order my food, and then about 15 mins later, it comes out. The couple next to me said "guten Appetit", and I thanked them and started to eat. It was so good that I actually said outloud "wow, this is amazing!" in French. Well, the couple overheard me and started laughing. They started talking to me, asking me where I was from (They thought I was from Germany!), what I was doing in France, etc. Then I asked them about themselves, they were from Luxembourg, and they were in Strasbourg for a 3 or 4 day trip. As we were talking, another couple who were actually from Alsace joined in and we ended up sitting in the restaurant talking about various things until it closed at 11PM. This would never happen at home!