John Thorne has an interesting discussion of baked beans - all of his discourses are both historical and cultural in nature - in Serious Pig. It is a Maine-focused discussion, and makes no mention whatever of tomatoes, but does discuss "sweets" vs. the more traditional "unsweets." "Sweets" typically are sweetened with molasses, perhaps rum, but it makes sense that tomatoes would be an alternative that worked its way in over time.

Additionally, tomatoes are definitely a native plant of the Americas, and were taken back to Europe after the colonization of America. As to who first added them to beans, I can't say, but I don't find much beyond what Gary posted in my rudimentary culinary library. I do know that they were certainly an import to Europe and - as Gary posted - were not eaten in Europe for some time because of fear that they were poisonous. Raymond Sokolov's excellent Why We Eat What We Eat discusses tomatoes at great length, but beans as a whole receive only a cursory mention with no discussion of how they are or were prepared or eaten.