Gone away is not usually a memory limit, actually. If it's memory limited, you usually get a different error. Though if you're hitting the max size limit, you have an underconfigured server or stupidly long queries. (of the 1MB sort of length)
More likely it's just a long query that didn't respect quickly enough back to the PHP code.