How to manually verify a signature given scriptSig and scriptPubKey?
Remember that 'scriptPubKey' and 'scriptSig' are scripts.  They are intended to be executed by an interpreter.  The reason your naive attempt didn't work, is because these values are not simple numbers, but are executable lines of code.

What happens, is that scriptSig is executed first, leaving values on the stack.  Then scriptPubKey is executed to check if the values left by scriptSig are valid.  Because scriptPubKey is the script specified by the output being spent, it encumbers the bitcoins, and is also called the encumbrance script.  So whoever last spent the bitcoins, gets to decide the terms by which the bitcoins are encumbered.  Usually it says something like "pay this output to whosoever has the private key that matches this public key"...but it doesn't have to.  This is how the system can handle multisig transaction, storing data, smart contracts, and multiple types of payments.  It's actually fairly complicated, which is why there is a programming language used rather than static keys and signatures.

Unfortunately, the best reference on how this code executes would be the interpreter.cpp file of the reference client (Bitcoin Core).  I know that's probably not the answer you were looking for, but this is really at the heart of what makes Bitcoin so flexible.