Cover the beans by at least an inch with cold water. Add a few pinches of salt and the thyme, garlic and onion ends and simmer until tender, about an hour.
When the beans are close to being done, heat the oven to 250 degrees F. Using a heavy, shallow ovenproof pan sauté the onion in the bacon fat over medium-low heat until soft, about 5 minutes. Stir in the spices and cook for another minute. Stir in the rest of the ingredients and simmer gently for 5 to 7 minutes, stirring occasionally, until the mixture thickens slightly.
Stir the beans and about 1/2 cup of their cooking water into the sauce in the pan. Cover the pan and put it in the oven for an hour to an hour and a half, until the beans are very soft and the sauce has thickened a bit.
Uncover the pan and cook until the sauce is quite dry, and the edges of the pan are slightly caramelized, another 20 to 30 minutes.