Add brown sugar, molasses, and vinegar to skillet; cook and stir until sugar is dissolved and mixture is bubbly. Add bacon, ketchup, and beans to skillet. Bring mixture to a boil; remove skillet from heat. Carefully spoon bean mixture into a baking dish.