Preheat the oven to 160°C (fan) / 180°C and prepare a deep 23cm circular springform tin by greasing and lining the base with non-stick baking paper.
Pour the stout into a large saucepan and add the butter. Place over a low heat until the butter has completely melted, ensuring that the mixture doesn't boil, then remove from the heat.
In a large mixing bowl, sift in the cocoa powder, then add the caster sugar and light brown sugar. Add the melted stout mixture and whisk together until well combined and smooth.
In a large jug, add the sour cream, eggs and vanilla extract, then whisk together until smooth. Pour this into the stout mixture and whisk once more until everything is well combined.
In a separate mixing bowl, add the gluten-free plain flour, xanthan gum, baking powder and bicarbonate of soda and mix together.
Add your dry ingredients to the wet mixture and whisk briefly until smooth and well combined. Make sure there aren't any lumps or pockets of flour, but don't overmix it either. I used an electric hand whisk for this part.
Pour the mixture into the prepared tin and place into the preheated oven for around 45–50 minutes until risen and cooked through. I'd recommend checking it from around the 42–45 minute mark as all ovens vary.
Check that the cake is finished by poking a skewer into the centre; you're looking for a few moist crumbs, but there shouldn't be any wet cake batter clinging to it. As this is a particularly moist, fudgy cake, don't worry if the skewer isn't completely spotless!Allow the cake to cool completely in the tin before carefully removing it. Don't be tempted to frost it whilst it's still warm or your cream cheese frosting will quickly become very soft. Whilst the cake is cooling, make the cream cheese frosting. I use a stand mixer for this part, but an electric hand whisk and a large bowl will do the job just fine too.
Place the softened butter into the bowl of a stand mixer and mix on a medium speed for about 5 minutes until considerably paler in colour.
Add the icing sugar and mix for a further 5 minutes. Before adding the cream cheese, make sure there isn't any excess liquid in the tub and drain it if necessary.
Add the cream cheese and vanilla extract, then mix for a further 2–3 minutes until well combined, light and fluffy.
Once the cake has completely cooled, spread a generous layer of cream cheese frosting all over the top, leaving the sides uncovered. You might not need every last bit of frosting, so simply add as much as you fancy.
Slice and enjoy!