Preheat the oven to 230 degrees C. Lightly spray a 12-hole deep patty pan tray with cooking spray. Using a 7.5 cm pastry cutter, cut a disc from each slice of bread. Flatten each bread disc with a rolling pin, then press into the oiled patty tins to line them evenly, curving the edge of the bread slightly to make large scalloped edges.
Brush the bread cases with the melted margarine and bake for 8–10 minutes or until crisp and golden. Set aside in a warm place until ready to fill.
Heat the oil in a large heavy-based frying pan with a well-fitting lid. Add the onions and stir well. Cover with the lid and cook over a low heat for 20 minutes or until the onions are very soft.
Remove the lid, turn up the heat and cook rapidly, stirring, until the onions turn a dark golden brown. Remove from the heat and stir in the sun-dried tomatoes and thyme. Season with salt and pepper.
Divide the onion filling among the croustades, then scatter the walnut pieces over the top. Serve hot.