You can substitute bass, hake, or haddock for the cod in this one-pot casserole.
Preheat oven to 425 degrees. Using a mandoline, slice potatoes a scant 1/8 inch thick. Drizzle 1 tablespoon oil in a shallow 3-quart lidded casserole. In slightly overlapping circles, alternate one-third each of potatoes, tomatoes, and shallots (about 1 tomato and shallot slice for every 5 or 6 potato slices). Drizzle with 1 tablespoon oil, scatter with one-third of thyme leaves, and season with salt and pepper. Repeat twice.
Roast, covered, until potatoes are knife-tender, 50 minutes. Season fish with salt and pepper; place lemon slices over potatoes, and fish on top. Drizzle with remaining oil; add thyme sprigs. Cover; roast until fish is cooked, 12 to 15 minutes. Let cool slightly before serving.