Bret,
This is your lucky day! I also have a 1991 535i that did the same thing and I know why it's happening. You have some wires that have worn through on one of the trunk hinges that are shorting out. I don't know why they cause the locks to automatically unlock, but they do. Until you repair the wires, it will continue.
On the driver's side trunk hinge, there's a black plastic cover. It covers the wires for the tail lights and the trunk lock solenoid. If you'll crawl inside the trunk, then slowly close the trunk, you'll see where the wires are constantly bending back and forth everytime you open and close the trunk. Somewhere inside the that bundle of wires, you have one or more that are either frayed or completely broken. I ended up putting in about 5-6 splices to repair mine. Once I did that, the locks locked first time, every time.
On the plastic cover around the trunk hinge, there are 3-4 clips that you can release with a small screwdriver that will allow you to remove the cover. Once you have it off, take a razor and slit the black tape covering the wires so that you can expose the wires. You'll actually want to start with the end right under the rear deck. Once you open it up, the damage will be evident. If a wire is in good shape but has a break in the sheath, you may be able to just apply some tape. For any broken ones, you'll have to use some similar wire and make some splices. Once you get all of them fixed, just rewrap the bundle of wires and put the plastic cover back on. I slighly repositioned the bundle under the shelf too. It's tedious (and sticky) work, but once you've fixed it, your locking problems will be solved. At least this was my problem and worked for me.
Grace and peace,
Robert K
1991 535i