Today I was able to reverse engineer the mechanism that switches the photos in the locket depending on the configuration. The key is having a two-part barrel that the halves pivot about. The two parts of the barrel are not attached, allowing them to separate when the locket is opened. Each half of the barrel is fixed to one of the movable heart pieces, allowing the other heart pieces to rotate around them, and allowing the barrel halves to slide over each other.
The next step is to incorporate this mechanism into my existing design. I will probably need a few more magnets to hold the locket closed. I will also modify some of the geometry of the barrels and the barrel slots so they are machinable.