In a food processor, add the mushrooms, shallots and chard and pulse until chopped and uniform, about 5 times.
Heat a large pan to medium high. Add the butter and cook until foaming. Add the mushroom mixture and toss. Let the ingredients brown, undisturbed, about 5 minutes. Stir, add the crushed red pepper and some salt and continue cooking for 10 more minutes. Set aside to cool.
Mix together the cooled mushroom mixture with the ricotta, thyme and 1/4 cup of the Parmesan. Season with more salt and crushed red pepper if needed. Add in the egg and stir until combined. Set aside.
Preheat the oven to 375 degrees F.
Using a mandoline, slice the potatoes thinly lengthwise; make sure they are very thin, almost translucent. You should be able to see your shadow behind them.
Spray an 8-by-8-inch glass baking dish with nonstick cooking spray. Place a layer of the potatoes on the bottom. Spread about 1/4 cup of the ricotta mixture across the slices and repeat about 6 times, or until you run out of potatoes or cheese mixture. Make sure the top layer is potatoes.
Cover tightly with foil and bake until the potatoes are tender, about 1 hour. Let rest for 15 minutes. Sprinkle with the chopped basil and remaining 1 tablespoon grated Parmesan and serve.