Prepare oven and casserole dish: Preheat oven to 400 F degrees. Spray a 9x13-inch baking dish with cooking spray. Set aside.
Saute onion and garlic: In a large saute pan add the butter and melt over medium-high heat. Add onion, and sauté for 4-5 minutes until soft and translucent. Add garlic and sauté for an additional 1 minute until fragrant.
Finish the sauce: Add the flour and stir until evenly combined. Cook for 1 more minute. Gradually pour in the broth, and whisk until combined. Add in the milk, salt, pepper, and whisk until combined. Continue cooking for an additional 1-2 minutes until the sauce just barely begins to simmer around the edges of the pan and thickens. Do not let it come to a boil.Remove from heat and set aside.
Assemble casserole: Spread half of the sliced potatoes in an even layer on the bottom of the pan. Top evenly with half of the cream sauce. Then sprinkle evenly with 1 cup of the shredded cheddar cheese. Top evenly with the remaining sliced potatoes, the other half of the sauce, and the remaining 1 cup of cheddar cheese.
Bake: Cover the pan with aluminum foil and bake for 45 minutes. The sauce should be nice and bubbly around the edges. Remove the foil and bake uncovered for another 30 minutes, or until the potatoes are cooked through.
Garnish and cool: Transfer the pan to a cooling rack and sprinkle with fresh thyme.