I havent seen this exactly before, but it does look like that soil is very wet... not sure if it is some sort of moisture retaining soil, but if it is, I would mix it with some sort of normal garden soil mixture... or peat or something that doesn't have polymer gelling agents... make sure you have good drainage, and replant.
it also looks like there could be some maggots there, you could reduce that problem with some diatomaceous earth on the surface; actually if you sprinkled 1/4 inch worth of quartz sand and DE on the bed it wouldnt stay wet on the surface.
of course if it isn't usually this wet, you could just replant and hope for the best.
I personally wouldn't have any concerns about eating the lettuce, after you trimmed off the yucky stuff; but use some heightened discretion, throw it away if it tastes bad, dont feed to a baby, dont feed it to someone who is immunocompromised, etc...
EDIT:
no maggots, I mistook some of the perlite...
