Drain the porcini, reserving the soaking water, and squeeze out any excess moisture.
Heat the oil in a heavy-based frying pan over a medium heat. Add the garlic and thyme and cook, stirring, for 30 seconds. Increase the heat to high. Add the porcini, season with salt and pepper and cook, stirring, for 1 minute. Pour in the reserved soaking water, stock and wine. Bring to the boil, then simmer, uncovered, over a very low heat for 15 minutes. Taste and adjust the seasoning.
Meanwhile, cook the pasta in a large saucepan of salted boiling water for 8–10 minutes, or according to the packet instructions, until al dente. Drain thoroughly, reserving a ladleful of the cooking water.
Return the pasta to the pan and place over a low heat. Stir in the sauce and the butter and combine thoroughly. Add the reserved cooking water and cook, stirring, for a few seconds until the pasta is well coated and looks silky. Serve immediately with grated Parmesan.