If the GameTooltip is showing for an item then the mouse is still over that item so you can use GetMouseFocus:
Code:
local focus = GetMouseFocus()
if not (focus:GetName() or ""):match("ContainerFrame%d+Item%d+") then return end
local bagID, slotID = focus:GetParent():GetID(), focus:GetID()
-- Do something with bagID, slotID