Deselect vertices with another mesh
Perhaps a simpler solution is possible (or automating the below steps), but here's what I came up with.

base - the mesh you're working on
selector - the mesh you want to use for (de)selecting
copy - the copy of base created in step 1.



Duplicate the base which now becomes the copy, add a Boolean modifier in Intersection mode and choose selector as a target. Apply the modifier.



Hide the selector.



Select all vertices of the copy and assign them to a new vertex group.



Select the copy in Object Mode, then the base (so the base is active), and switch from Object Mode to Weight Paint:



From Weights menu choose Transfer Weights.



Expand the panel that pops up in bottom-left corner:



Set Data Type to Vertex Groups.



Select Only Neighbor Geometry and decrease the Max Distance to the smallest non-zero value (try 0.00001)



Go back to Object Mode, remove the copy. Start editing the base:



You can now select the part shared with the selector:

 

Or make a selection:



And deselect the part shared with the selector: