Yes, you can use Mirror Dodge.
On your turn you used a standard and a swift action (plus probably a move action). So far so good.
Later in the initiative order you are attacked by the sneaky Rogue and you wish to use an immediate action to cast a spell.
Much like a swift action, an immediate action consumes a very small
amount of time but represents a larger expenditure of effort and
energy than a free action. However, unlike a swift action, an
immediate action can be performed at any time—even if it's not your
No problems here. An immediate action can be performed at any time, even when it isn't your turn.
But this is where the confusion comes in. As you stated, immediate and swift actions kind of use up the same action 'slot' and you can't use both in the same turn.
Using an immediate action on your turn is the same as using a swift
action and counts as your swift action for that turn.
But fortunately you aren't using the immediate action on your turn, but rather as part of your subsequent one.
You cannot use
another immediate action or a swift action until after your next turn
if you have used an immediate action when it is not currently your
turn (effectively, using an immediate action before your turn is
equivalent to using your swift action for the coming turn).
Here we can see that using an immediate action actually restricts whether you can perform a swift action on your next turn. Think of an immediate action as 'borrowing' the swift action from your next turn.