Assigning homogeneous boundary conditions, such as acoustic impedance, to the thermoviscous wave equations (TWE) derived by transforming the linearized Navier-Stokes equations (LNSE) to the frequency domain yields a so-called Helmholtz solver, whose output is a discrete set of complex eigenfunction and eigenvalue pairs. The proposed method -- the inverse Helmholtz solver (iHS) -- reverses such procedure by returning the value of acoustic impedance at one or more unknown impedance boundaries (IBs) of a given domain via spatial integration of the TWE for a given real-valued frequency with assigned conditions on other boundaries. The iHS procedure is applied to a second-order spatial discretization of the TWEs derived on an unstructured grid with staggered grid arrangement. The momentum equation only is extended to the center of each IB face where pressure and velocity components are co-located and treated as unknowns. One closure condition considered for the iHS is the assignment of the surface gradient of pressure phase over the IBs, corresponding to assigning the shape of the acoustic waveform at the IB. The iHS procedure is carried out independently for each frequency in order to return the complete broadband complex impedance distribution at the IBs in any desired frequency range. The iHS approach is first validated against Rotts theory for both inviscid and viscous, rectangular and circular ducts. The impedance of a geometrically complex toy cavity is then reconstructed and verified against companion full compressible unstructured Navier-Stokes simulations resolving the cavity geometry and one-dimensional impedance test tube calculations based on time-domain impedance boundary conditions (TDIBC). The iHS methodology is also shown to capture thermoacoustic effects, with reconstructed impedance values quantitatively in agreement with thermoacoustic growth rates.