How is the hash that is signed calculated? I'm a bit confused about the signature contained in the scriptSig of a transaction. My question is: what do we really sign? Is it the hash of the previous transaction?
scriptSig contians a signature of the concantenation* of the previous transaction's script and the new transaction.  It has to be both because if it were a signature of just the previous transaction, someone could swap the output address in the new transaction and relay the transaction sending the coins to himself!

scriptSig also contains the public key to verify the signature because the previous transaction only has the hash of the public key.  The hash of a public key is an address.

Source: https://en.bitcoin.it/w/images/en/7/70/Bitcoin_OpCheckSig_InDetail.png

* Not really concatenated, it's inserted in the middle.