I've tracked it down to the forum (FORUM_ID 360) not appearing in any of the categories in the "cache/forum_cache.php" file, which means it doesn't appear in the list of forums that can be managed. (It does, however, appear in the $tree['active'], $tree['kids'] and $tree['tree'] arrays in that cache file.)
Forum 360 was a child forum of forum 359. It seems that forum 359 has been deleted properly, but forum 360 hasn't, and thus still appears in the database, with no way of accessing it.
So...mystery solved. The problem was that the parent forum was deleted first, which meant that the child forum no longer appeared in the list of forums. This meant that the child forum couldn't be deleted, as it wasn't visible any more, but it affected the script.
I can fix the short-term issue, which is to find all orphaned child forums, and delete them manually (by explicitly setting the forumid in the ".../forums/admin/viewboard.php?forum=<forumid>" url path). The long-term automated solution would be either to reparent any child forums that haven't been deleted, or to recursively delete the child forums.