[i for i in bm.verts if i[my_id]]
This will work because any int value other than
0 will return
True. Therefore there's an assumption that you aren't using the value
0 for anything meaningful.
Custom id data is removed after
bm.free(). I don't know if it can be wiped before.
for the sake of completeness
>>> import bmesh
>>> bm = bmesh.new()
>>> obj = bpy.context.active_object
>>> my_id = bm.verts.layers.int.new('id')
This shows that even before you assign a specific value to your
layer.int for that vertex, it will already have a default 0.