A quick solution:
The following query will retrieve the Invocation Id directly from Adobe database.
SELECT long_lived_invocation_id FROM tb_action_instance WHERE id = '<Your Action Instance Id>'
However, there must be an elegant way to fetch this value through API. I will share with you if I find it.
There are two ways to terminate an action instance.
1. First way is to do it from the adminui, where in you can terminate the process task.
2. Second way is to do it from the database.
There are three tables in the LiveCycle Database that captures these details:
There are different flag status that is there corresponding to the different Actions that are there in LC.
The Most important thing: - You need to contact support (Adobe Technical Support for LiveCycle) who would be sending across the queries, related to the problem for executing if at all the problem can't be rectified from the adminui.
It is never advisable, nor recommended to touch and tweek around with the LC database without any guidance, since, the LC Database as lot of dependencies and constraints which might be effected if the database is updated without any proper guidance.
Hence, you could try to do this using the adminui first if at all it still doesnt get terminated, you could contact Adobe Technical Support (LiveCycle Team), to resolve that.