Preheat the oven to 200°C (400°F). Dice the onion, slice the tomatoes, and finely chop the garlic and chili pepper.
Sauté the onion and garlic in a little olive oil. Add the chili pepper and tomato sauce, and cook for a few minutes. Add the white wine to the mixture. Season the tomato sauce with sugar, salt, and pepper to taste.
Place the whole piece of cod and the sliced tomatoes into a baking dish and bake for about 12–14 minutes.
Pour a drizzle of olive oil over the tomato sauce, arrange the cod on top, and sprinkle with fresh thyme.