In Secret of My Excess, the episode opens with Twilight celebrating re-shelving day. After closing the curtains, she lights candles. She had never used that spell before (if she has...I'm a terrible pony-fan and should be trolled about it.) This is how I imagined she learned the spell.
Applejack caters the Princess' celebration, that nopony knows what it's for. Apparently, Twilight had volunteered herself, and the rest of the gang to help out. Once at the celebration, the Princess is kidnapped.
First story, don't be too harsh! :P