What shape is the rest of your electrical system in? Cleaning any corrosion and dabbing some dielectric grease in each and every connector is a required procedure on any old bike. You may have an intermittent electrical issue, but then again you may have a fuel system issue, or since the bike stalls when you put it in gear, I wonder if the clutch is sticking?
Maybe someone else can chime in on some of these thoughts, but we're probably going to need more info about the condition of each of these areas of your bike. How's the inside of your fuel tank? is the petcock screen clean? Since you haven't had the bike long it could be that you have a combination of issues causing this one symptom.
Please tell us more and pictures speak volumes so post them if you need to help explain anything.
You may want to re-title this thread along the lines of a stalling problem, it could get more attention from the better minds.
Good luck.
-Alan