From what I've researched beans and veggies can cause the gas and too much gas can cause back up in your digestive system to cause a heartburn. I would say try smaller meals, possibly avoid what you ate before/ test if that was what caused the heartburn, avoid lying down within 1 hour of eating, and have a warm beverage or soup after your meal (this tends to separate fatty foods that can also cause heartburn). Hope this helps. Praying you have a happy baby!
Oh, And I don't have any advice on the heartburn. Sorry.
You might be in the early stages of labor.