I've discovered that this may be related to the issue below:
https://moodle.org/mod/forum/discuss.php?d=320926
When Moodle checks grades using function grade_get_grades() it tests to see if the grade item requires updating, which for this particular course it does.
$course_item->needsupdate == 1 (line 351 gradelib.php)
It then generates a grade item for every user 'on the system' not just students on the course. This soon clock up millions of entries and grinds the server to a halt. Has anyone experienced this issue before or can suggest what may be happening?