Physically I don't think it is and impossible mission if you have 2 righthands, a 8.32 engine with cables and motronic and some understanding about electronics.
I discovered over the years that there are quite some similarities between the 164 and the Thema. One of the users (JRX 164) used to have a Thema 24V engine build in his 164; this was a one to one fit except for the top enginemount.
If you look at the subframe of the 164 and you compare that with the subframe of a Thema, you will see that all the mounts are in the right place.(The aft shockmount looks a little bit tilted however, but this aft shockmount could be used from a donor Thema.
My Q4 and a Lancia Thema 8.32:

RH side of a 164 (TD) enginebay:

LH side of a 164 (TD) enginebay:

RH side enginebay of a Thema:

LH side Lancia Thema enginebay:

8.32 engine installed in a Thema:

Empty Thema (8.32) enginebay:

