At times, things may be more fatty, and not only take longer to digest, but allow acid to slip more easily past the LES.
Also, you may have ingested something that relaxes the LES (the valve that holds the acid in your stomach), which then makes it less effective. For example, caffeine and alcohol are commonly known to relax the LES.
You're not alone with this...we've all experiences intermittent heartburn at times.
Hang in there! You could consider keeping journal of your eating and take note of circumstances around heartburn.
Oh, and stress can play a part as well. I've read that the pyloric valve at the bottom of the stomach (the one that allows emptying of stomach contents) can be less responsive, and hold food in your stomach longer, when you're stressed.
Just a few thoughts...
Hang in there! Keep those antacids handy!