Alright, I just walked into the right colleague, who pointed me to this article:
https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/nginx/index.html
Solved the problem. Seems, that nginx closes the connections before the heartbeats are sent. Increasing the timeouts in the nginx configuration did the trick.
keepalive_timeout 360s;
proxy_read_timeout 360s;