Cut all the bread into cubes. Heat the canola oil over medium heat, add the onion and saute until softened and translucent, about 5 minutes. Add the thyme leaves and salt and pepper, to taste. Add the diced ham, stir to combine and saute for another 1 to 2 minutes. Put the bread in a 9 by 13-inch baking dish and add the onion and ham mixture. Toss together.
Whisk the eggs and the milk in a small bowl, and season with salt and pepper, to taste. Pour the egg mixture over the bread mixture and let it sit for 15 minutes. Bake until the top is golden brown and the middle is set, about 30 to 35 minutes. Remove from the oven and serve.