Did you notice that what will happen after these two lines:
DELETE FROM Relacoes WHERE idContacto1 = id;
SELECT idContacto2 FROM Relacoes WHERE idContacto1 = id INTO idc;
idc will have always the default value of zero set by you. This is as you have already deleted the record related to it.
Once you correct your logic, you can use parameters to pass on the values if needed.
DECLARE @idc Int
Use, SELECT @idc...
Use, UPDATE... WHERE @idc=...
UPDATE:
I am still not sure what was so confusing. Try:
BEGIN
DECLARE @idc INT
SELECT @idc=idContacto2 FROM Relacoes WHERE something = id
UPDATE Contactos SET n=n-1 WHERE ctg = @idc;
END
Whould not the above thing do?