Please take my answer with a pinch of salt, I'm just learning, but fancy a go at this one.
In general, if a figure is on the wrong side of an account, then the account is out by twice that amount - it will take one amount to "zero" the offending entry, and a second, identical amount on the other side to make the account be what it should be.
So consider what it would take to correct the above amount owing: £39,282 - £12,345 to remove the entry on the wrong side - £12,345 to add it to the correct side = £14,592. Getting the uncorrected figure from the final one is the reverse of this process, but that way round is easier for me to explain.
I'll try to answer this without actually answering it, so you can reason it out based on what I've said. (You'll learn more effectively this way, than just accepting and possibly repeating any answer given to you, parrot fashion).
You have to think in terms of the balance brought forward, up to the point of the transactions described in the question, and you need to assume everything has been done correctly prior to those transactions.
Normally, when the VAT journals are posted, if there is money owing to HMRC, the VAT account will show a credit balance (and if a refund is due, a debit balance). When the payments are made/refunds received, and posted correctly to that account, the balance will become zero. Your starting point, therefore, is to assume all previous quarters have been dealt with correctly.
With that in mind, the last quarter's journals will have left a credit balance of £12,345 (since that was the amount of the payment, that's what we assume must have shown as owing on the return).
The payment should have been posted to that account as a debit - but it was posted as a credit. What does that mean for the balance? What, therefore, is the balance showing on the VAT account before the latest return is completed, and the journals posted?
Next, take into account the current return: It shows an amount owing to HMRC, so when it's journals are posted, it should put a credit amount on the VAT account. Given the balance prior to this return, what is the new balance?
If you work out the balance by following this, you'll get your answer.
__________________
Vince M Hudd - Soft Rock Software
(I only came here looking for fellow apiarists...)