A crooked accountant duped a sheriff into writing off his £11,700 compensation bill after a mistake by HMRC staff.