Does CiviDiscount work with Pay Later Memberships when using Price Sets
In Pete's case the problem turned out to be price sets not pay later. There is a fix now merged into master - but be aware that the code is 'consumed' when the pending transaction is created - not when it is confirmed