You could consider a 3.3VDC relay. You'd need to drive its coil and this would mean a single BJT circuit. Those relays are a couple of dollars, plus shipping. But it would work, for sure. And it's a very good option, actually.
But I think another possibility is that your BJT wasn't sufficiently driven by your I/O pin to hold in the door lock solenoid. Instead, it's likely that you oscillated because you didn't have enough current (or voltage) available.
Since you don't provide ANY details about your door lock solenoid, other than there is an adequate 12VDC source for it, let's just do a little over-kill with BJTs and go with that.
simulate this circuit – Schematic created using CircuitLab
In looking up door lock solenoids that run off of 12V, I found that at least some of them require about 2.6A in order to operate. So I'm going with that as an educated guess about your needs. Frankly, I think the above circuit will almost certainly work for you. But \$Q_1\$ will probably drop about \$400mV\$. I don't think that will be a problem for you, though.
The above circuit is designed to use the absolute minimum of parts, if you aren't using a relay (which as I said above, and which Roger wisely mentioned in his comment.) I've added the power requirements of each part, so you can make sure you get sufficiently rated parts. (The 2N3055 is already rated way more than you need, so just use it without question.) For example, \$R_1\$ will burn about \$500mW\$, so you should buy one that is rated for \$1W\$, at least. \$Q_2\$ won't be a problem. Even a TO-92 part will work find there.
\$Q_2\$ is going to operate somewhat saturated, so it will require some base current. If you are lucky, only \$2mA\$ or so. But even if this is more like \$5mA\$ you should be fine with your IO pin. \$R_1\$ sets the base current into \$Q_1\$ and is set to deliver \$200mA\$ or more. If you have various values of \$1W\$ resistors laying about, you might try a \$12\Omega\$ or a \$15\Omega\$ in there, as well. Or even larger, if the door latch continues to work okay. I've set it low to start out, so you get LOTS of current to drive the base of the 2N3055 BJT. Just to make sure.
You might also measure the current when you switch your latch. That information would help a lot in dialing in this circuit to fit, better. But I think the above circuit is overbuilt enough that it will do the job.
Oh. And the circuit is ON when you drive the IO PIN to LOW. When the IO pin is HIGH, then the circuit is OFF.
And I'm curious. How is the Raspberry Pi going to be better than a human being pressing the button to let someone in? Which adds another question. Would you prefer a circuit that the Raspberry Pi triggers, but where the circuit itself times the duration and then automatically removes the power so that the door is no longer unlocked? (Would be very simple to add that capability.)