Phew, that was hard work ;)
Glad you got it in the end though.
Are you learning linear algebra or just looking at game programming material? A bit of linear algebra would help you (especially so your terminology is understandable to the likes of Alvaro and myself). Note how we managed to say what you were trying to achieve in a few equations which are a lot less ambiguous than wordy descriptions.
EDIT: If you want the quaternion solution, it's fairly similar.
If you have
vout = q * vin * q-1
then (multiplying on left by q-1)
q-1 * vout = q-1 * q * vin * q-1 = vin * q-1
(multiply on right by q)
q-1 * vout * q = vin * q-1 * q = vin
so
vin = q-1 * vout * q
an since quaternions are normally unit length then q-1 = conjugate(q).
Note, this is similar to the matrix version because if you have
vout = M * vin then vin = M-1 * vout. In the quaternion version, you have
vout = q1 * vin * q1-1
and
vin = q1-1 * vout * q1
then writing q2 = q1-1 we have
vin = q2 * vout * q2-1
which is the same equation as for vout but with q1 replaced with q1-1
EDIT2: The algebra works the same way as for matrices, you have to be careful whether you are multiplying on the right or the left hand side of each equation though, since matrices and quaternions aren't commutative (a*b != b*a in general) but are associative (i.e. you don't need brackets for multiplication since a*(b*c) = (a*b)*c, so you can write a*b*c with no ambiguity). A matrix and its inverse always commutes though, as does a quaternion and its inverse.
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley