Preheat the oven to 350 degrees F.
Put the bacon in a large, cold skillet and cook over medium heat until the fat renders and the bacon is almost crisp, about 8 minutes. Add the onion and cook, stirring occasionally, until softened, about 5 minutes. Add 1 of the cans of beans with their liquid. Drain and rinse the remaining beans, then add them to the skillet. Add the ketchup, sugar, mustard, vinegar, Worcestershire, 1/2 teaspoon salt and pepper to taste. Bring to a low simmer, then transfer to a small baking dish. Bake uncovered until thickened and bubbly, about 50 minutes. Serve warm.