Peter, I'll bet you have 'Revalue Inventory for Cost Variance' checked in your Item Classes and Item Purchasing Options. Read my blog post about this here - gp2themax.blogspot.com/.../gptip42day-revalue-inventory-for-cost.html.
When this box is checked, Purchase Receipt costs are updated during the Invoice match process, updating the unit cost on the receipt layer. If that receipt layer has been sold, GP adjusts COGS for previously sold items from the layer in the period in which the item was sold.
Uncheck the box in your Item Classes, roll the changes down to the items, and that should resolve the issue.