If you attack a blue jelly in melee without killing it, and you do not have cold resistance, it will gain HP equal to half the damage it inflicts on you. Attacking it, even if you miss, may cause the blue jelly to divide in two. (“The blue jelly multiplies from your heat!”).
Avoid attacking a blue jelly in melee unless you have cold resistance, as blue jellies are much tougher than might be expected, and their cold passive attack can be deadly to inexperienced players. At their base level, they do (4+1)d6 damage, which gives a range of 5–30, and they can be generated at much higher levels.
Ranged attacks are preferable, but make sure you have enough ranged weapons to finish the job—you won't be able to retrieve that lovely stack of daggers until the jelly is dead. The aklys is a solid option that likely should be used first - at worst, the aklys has a 1% chance that it will fail to return, but you will most likely do enough damage that you can kill the jelly with your remaining projectiles, preserving valuable darts, wand charges and/or other items.
I'd planned how to prevent the lock from sealing behind me; it
required a temporary sacrifice, not cleverness. I used the door
itself to help me cut off a portion of my body, after shunting all
memory from the piece to be abandoned. The piece, looking
inexpressibly dear and forlorn for a bit of blue jelly, would
force open the outer door until I returned and rejoined it.