Sure. Is this from a serial field???
You can do it like this:
begin;
insert into table values (DEFAULT, val1,val2);
select currval('seqname');
insert into dep_table values (id_fromabove,vala,valb);
commit;
where DEFAULT is in the position of your serial field (DEFAULT was introduced in 7.3, by the way) If you're on 7.2. or before, you have to list the field names:
insert into table (field1,field2) values (val1, val2);
OR
begin;
select nextval('seqname');
insert into table (id, field1, field2) values (id_fromabove,val1, val2);
... rest the same as above.
The docs cover this pretty well actually, look in the section under the user docs / functions / sequence functions.