You were caught in the middle of an ambush. You are at best in Skyrim illegally and at worst an agent of the Stormcloaks. Tulius didn't make the call on your execution, he allowed the Captain in charge manage things, but he doesn't hold it against you when/if he sees you next. The captain is an uncomplicated woman who would rather apologize for executing a minor criminal than for allowing a Stormcloak agent go free under the guise of an innocent bystander. To a certain sort of mind, that would be a logical conclusion. From a personal perspective, it's less forgivable.