Answering this question:
I'm really really keen to get this fixed, but I really don't have any idea where to start :/
You can start to rescue this error, log it, send one e-mail to you and since it happens only some times, retry (using the "retry" command). After this, you might want to check the last actions that this IP executed and see if it is related. Log also log the session variables.
Maybe you are getting timeouts in high server usage - try to use one tool lime newrelic or even log memory usage, cpu usage and disk usage yourself along with the other info.
EDIT:
Since it is not only one action, you can get every error on ApplicationController like this:
class ApplicationController < ActionController::Base
rescue_from MyException, :with => :handle_my_exception
def handle_my_exception
grab_data
send_mail
retry
end
end
I thought it was on an specific action, so I'm not sure if retry works here. But even if you can't retry, you can still getting more info and sending by e-mail to yourself this way. Of course you will want to add a retry counter logic, or else you will be in trouble.
EDIT again:
Thinking better, you can simulate a retry from there with a redirect_to based on the request parameters. In this answer he explains how to get it. Don't forget to send the params too.